开发者

TargetType="{x:Type GroupItem}" arrow style in wpf

开发者 https://www.devze.com 2023-01-15 01:02 出处:网络
How to change arrow style for <wpftoolkit:开发者_JAVA技巧DataGrid.GroupStyle>Please find the solution for the above question

How to change arrow style for <wpftoolkit:开发者_JAVA技巧DataGrid.GroupStyle>


Please find the solution for the above question

        <ControlTemplate x:Key="newToggleButtonControlTemplate" TargetType="{x:Type ToggleButton}">
            <Grid>
                <Ellipse Fill="{DynamicResource ExpanderArrowFill}" 
                         Stroke="DarkGray" 
                         HorizontalAlignment="Center" 
                         x:Name="circle"                       
                         VerticalAlignment="Center" 
                         Width="20" Height="20"/>
                <Path 
                x:Name="Up_Arrow" 
                HorizontalAlignment="Center" 
                VerticalAlignment="Center" 
                Fill="White" 
                Data="M 0 0 L 5 5 L 10 0 Z" />

                <Path 
                x:Name="Down_Arrow" 
                Visibility="Collapsed" 
                HorizontalAlignment="Center" 
                VerticalAlignment="Center" 
                Fill="White"                     
                Data="M 0 5 L 5 0 L 10 5 Z" />
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="circle"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="true">
                    <Setter Property="Fill" Value="{DynamicResource PressedBrush}" TargetName="circle"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="true">
                    <Setter Property="Visibility" Value="Visible" TargetName="Down_Arrow"/>
                    <Setter Property="Visibility" Value="Collapsed" TargetName="Up_Arrow"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <Style x:Key="newExpanderStyle" TargetType="{x:Type Expander}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Expander}">
                        <Grid Background="#720151">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*" x:Name="ContentRow"/>
                            </Grid.RowDefinitions>
                            <Border 
                            x:Name="Border" 
                            Grid.Row="0" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            CornerRadius="2,2,0,0" >
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <ToggleButton                                              
                                    Template="{DynamicResource newToggleButtonControlTemplate}"                                                                                    
                                    IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"  OverridesDefaultStyle="True" />
                                    <ContentPresenter Grid.Column="1" Margin="4" RecognizesAccessKey="True" ContentSource="Header"  />
                                </Grid>
                            </Border>
                            <Border 
                            x:Name="ExpandSite" 
                            Grid.Row="1" 
                            Visibility="Collapsed" 
                            BorderThickness="1,0,1,1" 
                            CornerRadius="0,0,2,2" >
                                <ContentPresenter 
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"                                         
                                Focusable="false"/>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded" Value="True">
                                <Setter Property="Visibility" Value="Visible" TargetName="ExpandSite"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

Thanks to all

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号