从另一个 ResourceDictionary XAML 中应用 Windows.Resource 中的样式
Apply styles in Windows.Resource from another ResourceDictionary XAML
我的 XAML 代码需要一些帮助。
我有这个代码。我在每个 TextBox 控件中使用引用中的样式,效果很好。
xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer"
<TextBox x:Name="Name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Middle name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Last name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Age" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
现在我要做的是创建 TextBox 控件而不直接在每个控件中应用样式。我已经这样做了,但这不起作用。
任何建议。
xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer"
<Window.Resources>
<ResourceDictionary>
<Style TargetType="TextBox">
<Setter Property="Style" Value="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<TextBox x:Name="Name" />
<TextBox x:Name="Middle name"/>
<TextBox x:Name="Last name" />
<TextBox x:Name="Age"/>
谢谢。
尝试使用如下样式:
<Style TargetType="TextBox" BasedOn="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/>
我的 XAML 代码需要一些帮助。 我有这个代码。我在每个 TextBox 控件中使用引用中的样式,效果很好。
xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer"
<TextBox x:Name="Name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Middle name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Last name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
<TextBox x:Name="Age" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/>
现在我要做的是创建 TextBox 控件而不直接在每个控件中应用样式。我已经这样做了,但这不起作用。 任何建议。
xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer"
<Window.Resources>
<ResourceDictionary>
<Style TargetType="TextBox">
<Setter Property="Style" Value="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<TextBox x:Name="Name" />
<TextBox x:Name="Middle name"/>
<TextBox x:Name="Last name" />
<TextBox x:Name="Age"/>
谢谢。
尝试使用如下样式:
<Style TargetType="TextBox" BasedOn="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/>