如何在 Windows 10 UWP XAML 上更改焦点文本框样式?
How change focused TextBox style on Windows 10 UWP XAML?
当 TextBox 具有焦点时,如何将自定义样式(来自资源)应用到它。
我通常的解决方案
<Style TargetType="TextBox" x:Key="NoteBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
不影响聚焦或选择状态。
您必须在其 VisualState 中编辑 Setters。您可以获得默认模板 here.
只需复制它并编辑 Focused
VisualState 中的值。
当 TextBox 具有焦点时,如何将自定义样式(来自资源)应用到它。
我通常的解决方案
<Style TargetType="TextBox" x:Key="NoteBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
不影响聚焦或选择状态。
您必须在其 VisualState 中编辑 Setters。您可以获得默认模板 here.
只需复制它并编辑 Focused
VisualState 中的值。