c# - How to style TextBox headers with multiple colors in Xaml UWP? -


i have lot of textboxes (100's) , want style them such part of textbox color , other in certain.

enter image description here

the above image states need. asterisk red in color.

i have achieved using code

<textbox.header>     <textblock >         <run >card number</run><run foreground="red">*</run>     </textblock> </textbox.header>  

but have many textboxes can write style achieve this? content of header dynamic wondering how can this?

alright achieved creating below styling.

<style x:key="mandatorytextbox" targettype="textbox">     <setter property="headertemplate">         <setter.value>             <datatemplate>                 <textblock>                      <run text="{binding}"></run><run foreground="red">*</run>                 </textblock>             </datatemplate>         </setter.value>     </setter> </style> 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -