Hi @Anderson Rodrigues Cavalcante ,
Welcome to Microsoft Q&A!
The default template of Textbox
can be found in generic.xaml
in: C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\{version}\Generic.
Find the resource TextControlBorderBrushFocused
and modify its value with a new SolidColorBrush
.
However, if my SO is in High Contrast mode, I'd like to keep these native borders
In HighContrast mode, TextControlBorderBrushFocused"ResourceKey
" still use default SystemControlHighlightAccentBrush
.
<TextBox Text="TextBox" >
<TextBox.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="TextBorderTransparentBrush" Color="Red" />
<StaticResource x:Key="TextControlBorderBrushFocused" ResourceKey="TextBorderTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="TextBorderTransparentBrush" Color="Green" />
<StaticResource x:Key="TextControlBorderBrushFocused" ResourceKey="TextBorderTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="TextControlBorderBrushFocused" ResourceKey="SystemControlHighlightAccentBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</TextBox.Resources>
</TextBox>
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.