I need some help with my XAML code. I have this code. I use the style from the references in each TextBox control, that works perfectly.
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}"/>
Now I want to do is to create the TextBox controls without directly apply the style in each one. I have done this, but that doesn't work. Any suggestions.
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"/>
Thanks.
Try use Styles looks like:
<Style TargetType="TextBox" BasedOn="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/>