This question is locked. New answers and comments are not allowed.
Hi,
I need to develop a sorting functionality for a few columns by clicking on the grid header.
Can anyone suggest me a method to do it.
I have put a hyperlink button in the ContentTemplate of ColumnHeaderContainer. I am unable to figure out the way to attach a command to the HyperlinkButton.
If there can be a better approach than this please suggest.
Thanks and Regards
Prolay
I need to develop a sorting functionality for a few columns by clicking on the grid header.
Can anyone suggest me a method to do it.
I have put a hyperlink button in the ContentTemplate of ColumnHeaderContainer. I am unable to figure out the way to attach a command to the HyperlinkButton.
If there can be a better approach than this please suggest.
<Style x:Key="ColumnHeaderContainerStyle" TargetType="gantt:ColumnHeaderContainer"> <Setter Property="SubitemsPadding" Value="0" /> <Setter Property="SubitemsGap" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="gantt:ColumnHeaderContainer"> <Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ToggleButton IsChecked="{Binding IsExpanded, Mode=TwoWay}" Margin="{TemplateBinding Padding}" Style="{StaticResource ExpandToggleButtonStyle}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{TemplateBinding Foreground}" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{Binding SourceItem}" /> <!--IsEnabled="{Binding CanExpand}"--> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <HyperlinkButton Content="{Binding Header}" /> </DataTemplate> </Setter.Value> </Setter> </Style>Thanks and Regards
Prolay