我想在WPF扩展头上应用样式。 在下面的XAML中,我有一个扩展器,但是它的样式不仅适用于标题。 谢谢。 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="640" > <StackPanel> <StackPanel.Resources> <Style TargetType="Expander"> <Style.Resources> <LinearGradientBrush x:Key="BackBrush" StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#EF3132" Offset="0.1" /> <GradientStop Color="#D62B2B" Offset="0.9" /> </LinearGradientBrush> </Style.Resources> <Setter Property="Background" Value="{StaticResource BackBrush}"/> </Style> </StackPanel.Resources> <Expander> <StackPanel> <TextBlock>Bike</TextBlock> <TextBlock>Car</TextBlock> <TextBlock>Truck</TextBlock> </StackPanel> </Expander> </StackPanel> </Page>