8
Tengo este XAML. Si elimino la sección StackPanel.Resources obtengo los estilos que se definieron en el nivel de la aplicación. Si lo dejo, solo obtengo los nuevos estilos.WPF Style Herencia
¿Cómo lo hago para combinar los estilos local y global?
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" >
<StackPanel.Resources>
<Style TargetType="TextBlock" >
<Setter Property="Margin" Value="4" />
</Style>
<Style TargetType="Button" >
<Setter Property="Margin" Value="4" />
</Style>
</StackPanel.Resources>
<Border Padding="5" BorderBrush="Blue" BorderThickness="4" >
<StackPanel>
<TextBlock>Applications</TextBlock>
<Button>Open Issues</Button>
<Button>Services</Button>
</StackPanel>
</Border>
</StackPanel>
<StackPanel></StackPanel>
</DockPanel>
</Window>
En caso de que ayude, así es como definí los estilos globla.
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary Source="ShinyBlue.xaml"/>
</Application.Resources>
</Application>
¿Y si el estilo de nivel de aplicación no tiene un nombre ? –
simplemente le da al BaseTypeName como "TextBlock" –
¿Quiere decir como