Reputation: 55
I am developing an Universal Windows Platform App using XAML
& C#
. I want to change Border Color of TextBox
on Focus in UWP.
Thanks in advance for Help.
Upvotes: 3
Views: 3988
Reputation: 1155
Well it is actually very simple to achieve, just follow these steps:
Step 1. add a textbox to your page.
step 2. right click on your textbox and pick : "EditTemplate" \ "Edit a Copy..."
this will take you to the template designer stage.
step 3. check this image: https://postimg.org/image/ocdn34is1/
Upvotes: 3
Reputation: 29792
You need to edit the Style of your TextBox, the default one you can generate via designer or take from MSDN. There in visual states you will find Focused - change whatever you want in it:
<VisualState x:Name="Focused">
<Storyboard>
... some code
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="Green"/>
</ObjectAnimationUsingKeyFrames>
... some code
</Storyboard>
</VisualState>
Upvotes: 1