c# - change BorderBrush on Focus of TextBox in XAML -
issue
i have been trying change borderbrush of textbox on focus couple of days , not want work.
i have written code people have suggested border seems change on 'right-click' of textbox , not on focus?
here code have written:
<textbox text="{binding serverurl, updatesourcetrigger=propertychanged}" padding="2" borderthickness="2" verticalalignment="stretch" grid.row="1" fontfamily="sans serif" foreground="#858585" fontsize="10px" fontweight="medium"> <textbox.resources> <style targettype="{x:type border}"> <setter property="cornerradius" value="2"/> </style> </textbox.resources> <textbox.style> <style targettype="{x:type textbox}"> <style.triggers> <trigger property="isfocused" value="true"> <setter property="borderbrush" value="red" /> </trigger> </style.triggers> </style> </textbox.style> </textbox>
like mentioned work when right click textbox, need work on left click (when textbox focused).
anyone have suggestions?
the textbox control has "focused" visual state trigger built-in, change values of trigger, it's pretty simple follow these steps:
step 1. add textbox page.
step 2. right click on textbox , pick : "edittemplate" \ "edit copy..."
this take template designer stage.
step 3. check image: https://postimg.org/image/ocdn34is1/
Comments
Post a Comment