WPF Expander style

    <!--ExpanderStyle-->
            <Style x:Key="ExpanderStyleOne" TargetType="{x:Type Expander}">
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontSize" Value="14" />
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Expander}">
                            <Canvas Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                <ToggleButton x:Name="HeaderSite"
                          Canvas.Top="0"
                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                          Content="{TemplateBinding Header}"
                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                          Style="{DynamicResource ToggleButtonStyleOne}"/>
                                <Border x:Name="ExpandSite"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Visibility="Collapsed"
                                        Canvas.Top="56" Canvas.Left="0"
                                        Focusable="false"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        Width="{Binding ElementName=HeaderSite,Path=Width}"
                                        Background="#FF6a8d9c">
                                    <ContentPresenter Margin="0 0"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                </Border>
                            </Canvas>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded" Value="False">
                                    <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ToggleButtonStyleOne" TargetType="{x:Type ToggleButton}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Width" Value="285"/>
                <Setter Property="Height" Value="56" />
                <Setter Property="Background" Value="{DynamicResource ReviewGridbackground}" />
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontSize" Value="14" />
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="0 0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <Canvas x:Name="canvNormal" Visibility="Visible"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="235" Height="56" Opacity="0"/>
                                    <Rectangle Width="15" Height="56" Fill="#4a5f6a" Canvas.Right="0"/>
                                    <Image Source="../Image/1.PNG"  Margin="235,0,0,0" Height="55"  Width="15"/>
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>
                            <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="25"/>-->
                                    <!--<Line X1="0" Y1="0" X2="0" Y2="15" Stroke="#297eb4" StrokeThickness="3"
                                    Margin="6 10" StrokeDashArray="1" Canvas.Right="0"/>-->
                                    <!--<Rectangle Width="{TemplateBinding Width}" Height="1" Canvas.Bottom="0" Fill="#FFbacfda" />-->
                                </Canvas>
                                <Canvas x:Name="canvChecked" Visibility="Hidden"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="235" Height="56" Opacity="0"/>
                                    <Rectangle Width="15" Height="56" Fill="#4a5f6a" Canvas.Right="0"/>
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="8"/>
                                <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>-->
                                    <Image Source="../Image/2.PNG"  Margin="235,0,0,0"  Height="55"  Width="15"/>
                                    <!--<Rectangle Width="{TemplateBinding Width}" Height="1" Canvas.Bottom="0" Fill="#FFbacfda" />-->
                                </Canvas>
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                 Margin="{TemplateBinding Padding}"
                                                 RecognizesAccessKey="True"
                                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                 VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Canvas>

                            <ControlTemplate.Triggers>
                                <!--<Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="#FFd2e7f4" />
                        </Trigger>-->
                                <Trigger Property="IsChecked" Value="true">
                                    <Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
                                    <Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
                                </Trigger>
                                <!--<Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>-->
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ExpanderStyleTwo" TargetType="{x:Type Expander}">
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontSize" Value="14" />
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Expander}">
                            <Canvas Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                <ToggleButton x:Name="HeaderSite"
                          Canvas.Top="0"
                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                          Content="{TemplateBinding Header}"
                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                          Style="{DynamicResource ToggleButtonStyleTwo}"/>
                                <Border x:Name="ExpandSite"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Visibility="Collapsed"
                                        Canvas.Top="35" Canvas.Left="0"
                                        Focusable="false"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        Width="{Binding ElementName=HeaderSite,Path=Width}"
                                        Background="#4a5f6a">
                                    <ContentPresenter Margin="0 0"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                </Border>
                            </Canvas>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded" Value="False">
                                    <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ToggleButtonStyleTwo" TargetType="{x:Type ToggleButton}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Width" Value="250"/>
                <Setter Property="Height" Value="56" />
                <Setter Property="Background" Value="{DynamicResource ReviewGridbackground}" />
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontSize" Value="14" />
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="0 0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <Canvas x:Name="canvNormal" Visibility="Visible"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="250" Height="{TemplateBinding Height}" Opacity="0"/>
                                    <!--<Rectangle Width="15" Height="35" Fill="#FFc7ebff" Canvas.Right="0"/>-->
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="8"/>
                            <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>-->
                                    <!--<Line X1="0" Y1="0" X2="0" Y2="15" Stroke="#297eb4" StrokeThickness="3"
                                    Margin="6 10" StrokeDashArray="1" Canvas.Right="0"/>-->
                                </Canvas>
                                <Canvas x:Name="canvChecked" Visibility="Hidden"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="250" Height="{TemplateBinding Height}" Opacity="0"/>
                                    <!--<Rectangle Width="15" Height="35" Fill="#FFc7ebff" Canvas.Right="0"/>-->
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="8"/>
                                <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>-->
                                    <!--<Image Source="image/1.PNG"  Margin="228,-1,0,0"/>-->
                                    <Rectangle Width="{TemplateBinding Width}" Height="1" Canvas.Bottom="0" Fill="#FFbacfda" />
                                </Canvas>
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                 Margin="{TemplateBinding Padding}"
                                                 RecognizesAccessKey="True"
                                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                 VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Canvas>

                            <!--<ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="#FFd2e7f4" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
                            <Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ExpanderStyleThree" TargetType="{x:Type Expander}">
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontSize" Value="14" />
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Expander}">
                            <Canvas Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                <ToggleButton x:Name="HeaderSite"
                          Canvas.Top="0"
                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                          Content="{TemplateBinding Header}"
                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                          Style="{DynamicResource ToggleButtonStyleThree}"/>
                                <Border x:Name="ExpandSite"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Visibility="Collapsed"
                                        Canvas.Top="35" Canvas.Left="0"
                                        Focusable="false"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        Width="{Binding ElementName=HeaderSite,Path=Width}"
                                        Background="#4a5f6a">
                                    <ContentPresenter Margin="0 0"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                </Border>
                            </Canvas>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded" Value="False">
                                    <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ToggleButtonStyleThree" TargetType="{x:Type ToggleButton}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Width" Value="250"/>
                <Setter Property="Height" Value="114" />
                <Setter Property="Background" Value="{DynamicResource ReviewGridbackground}" />
                <Setter Property="Foreground" Value="#FF217cb5"/>
                <Setter Property="FontSize" Value="14" />
                <Setter Property="FontFamily" Value="宋体" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="0 0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <Canvas x:Name="canvNormal" Visibility="Visible"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="250" Height="{TemplateBinding Height}" Opacity="0"/>
                                    <!--<Rectangle Width="15" Height="35" Fill="#FFc7ebff" Canvas.Right="0"/>-->
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="8"/>
                            <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592L13.494,10.697z" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>-->
                                    <!--<Line X1="0" Y1="0" X2="0" Y2="15" Stroke="#297eb4" StrokeThickness="3"
                                    Margin="6 10" StrokeDashArray="1" Canvas.Right="0"/>-->
                                </Canvas>
                                <Canvas x:Name="canvChecked" Visibility="Hidden"
                                 Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                                 Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Right="0">
                                    <Button Width="250" Height="{TemplateBinding Height}" Opacity="0"/>
                                    <!--<Rectangle Width="15" Height="35" Fill="#FFc7ebff" Canvas.Right="0"/>-->
                                    <!--<Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="8"/>
                                <Path Data="M13.494,10.697l-3.497-3.6l-3.497,3.6L6.494,8.328l3.503-3.631l3.48,3.592" Fill="#297eb4" Canvas.Right="4" Canvas.Top="15"/>-->
                                    <!--<Image Source="image/1.PNG"  Margin="228,-1,0,0"/>-->
                                    <Rectangle Width="{TemplateBinding Width}" Height="1" Canvas.Bottom="0" Fill="#4a5f6a" />
                                </Canvas>
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                 Margin="{TemplateBinding Padding}"
                                                 RecognizesAccessKey="True"
                                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                 VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Canvas>

                            <!--<ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="#FFd2e7f4" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
                            <Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

使用Expander的示例:

 <Expander Name="ExpanderTools" Style="{DynamicResource ExpanderStyleOne}" IsExpanded="True" ExpandDirection="Down">
                    <Expander.Header>
                        <Grid Name="ExpanderToolsHeaderGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="2"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="2"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="40"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <ToggleButton Grid.Column="1" Grid.Row="1"  />
                            <ToggleButton Grid.Column="2" Grid.Row="1" />
                            <Button Grid.Column="3" Grid.Row="1"/>
                            <ToggleButton Grid.Column="4" Grid.Row="1" />
                            <ToggleButton Grid.Column="5" Grid.Row="1" />
                        </Grid>
                    </Expander.Header>
                    <Expander.Content>
                        <Grid Name="ExpanderToolsContentGrid" Background="#4a5f6a">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="2"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="2"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="40"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="40"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <ToggleButton Grid.Column="1" Grid.Row="1" />
                            <ToggleButton Grid.Column="2" Grid.Row="1" />
                            <ToggleButton Grid.Column="3" Grid.Row="1" />
                            <ToggleButton Grid.Column="4" Grid.Row="1" />
                            <ToggleButton Grid.Column="5" Grid.Row="1" />
                            <ToggleButton Grid.Column="6" Grid.Row="1"/>
                            <ToggleButton Grid.Column="1" Grid.Row="3" />
                        </Grid>
                    </Expander.Content>
                </Expander>

运行效果:

需要注意的是:Expander展开后,有可能会出现Expander内容区域范围到达其他内容区域时,显示其他区域的内容,造成交叉背景显示。

此时需要将被当区域控件的 Panel.ZIndex="-1" 该值设置为负数。

原文地址:https://www.cnblogs.com/runningRain/p/8946035.html

时间: 2024-07-31 03:48:28

WPF Expander style的相关文章

WPF 样式(Style)初体验 (一) 作用域

刚刚接触WPF的开发,顿时对样式设计产生了兴趣.因为之前对CSS比较感兴趣,不难发现WPF的Style和CSS的模式很类似.下面我就根据自己初步的理解和CSS样式表对比做下总结,有理解不正确的地方还希望各位前辈指正. (1)全局样式控制 影响的是整个项目的样式,我们可以在App.xaml文件里定义全局的样式(这里就类似于我们在一个web的项目中添加一个全局的CSS文件,然后在每个页面引用CSS样式): <Application.Resources> <Style TargetType=&

WPF CHECKBOX STYLE

源自 http://www.wpfhelper.com/index.php/android-ui-for-wpf/23-modern-ui-for-wpf/android-ui-for-wpf/26-wpf-checkbox-style-inspired-by-android CheckBoxStyleXAMLWPF How create WPF CheckBox style and customize it. The CheckBox style is inspired by Android

WPF——Expander控件(转)

Expander是一个可以展开和折叠的控件,它包含两部分标头和内容. 标头通Header属性来设置,内容通过Conent属性设置,如下面一个简单的例子: Expander ExpandDirection = Down Width = 96 Expander.Header TextBlock Text = 标题 FontWeight = Bold / / Expander.Header Expander.Content TextBlock TextWrapping = Wrap T Expande

WPF 中style文件的引用

原文:WPF 中style文件的引用 总结一下WPF中Style样式的引用方法: 一,内联样式: 直接设置控件的Height.Width.Foreground.HorizontalAlignment.VerticalAlignment等属性.以设置一个Botton控件的样式为例,如: 复制代码 <Grid x:Name="ContentPanel" > <Button Content="Button" Name="btnDemo"

WPF Expander 炫酷自定义Style

首先, 看一下效果图. 实现思路 1.PS处理两张选中得特效背景, 一张为主选择得效果图, 另外一张为次选择项得效果图. ![](https://img2020.cnblogs.com/blog/1161656/202003/1161656-20200325221915253-468522090.png) ![](https://img2020.cnblogs.com/blog/1161656/202003/1161656-20200325221923049-516705706.png) 图片资

从0 开始 WPF MVVM 企业级框架实现与说明 ---- 第五讲 WPF中 Style

Style这个东西几乎是无处不在,这个类似于web开发中的css样式,想要做一个很丰富的UI,这个东西是必不可少的,我也不是专业的UI开发者,这边只能介绍Style在WPF中的用法 下面有一个下载地址,这个demo还可以供初学者学习 Style基本用法: 在WPF中我们可以使用Style来设置控件的某些属性值,并使该设置影响到指定范围内的所有该类控件或影响指定的某一控件,比如说我们想将窗口中的所有按钮都保持某一种风格,那么我们可以设置一个Style,而不必分别设置每个按钮的风格. Style是作

[WPF] 为Style 里的button添加鼠标点击响应事件

一个TabControl, 用的是PagedTabControl style, 在style中有个button, button在style里已经写了click事件,但是现在还需要加上一段功能,就是在响应事件之前对界面作一下判断.该怎么办呢?先看代码: 1. 控件XAML部分代码(位于文件form_loadatorigin.xaml): <!-- Form Body --> <TabControl x:Name="formLoadUnload" Style="

wpf 将Style应用到 ListView 中的 ListViewItem 元素

例: 为每个条目元素设置右键菜单 1. 新建右键菜单元素和样式元素 注意: 同时设置样式元素的 TargetType 属性和 x:Key 属性, 将样式元素限定为应用于 ListViewItem 类型元素并且需要显示指定才可应用 <Window.Resources> <ContextMenu x:Key="ContextMenuTest"> <MenuItem Header="右键菜单1"/> <MenuItem Heade

WPF Expander联动

Expander的Header放入Radiobutton,Expander的IsExpanded属性绑定Radiobutton的IsChecked属性,修改Radiobutton样式去掉Radiobutton的选择圆圈.