Hello,
I have bought the Terelik DevCraft package and now I am working to convert some of my controls to Telerik controls.
I started with a DataGrid, this DataGrid has a GroupStyle and I am trying to apply this groupstyle to my new GridView.
The groupstyle has a converter which checks if the group contains more than 1 items, then it wil create a groupbox around the item with a header which specificies to which order the items belong. When there is only 1 item in the group there is no groupbox and no header.
I want to have the same functionality in my new GridView, my new GridView already group the items by ordernumber in an expander, I am now a bit lost on how to style the header so it shows the same information as my former groupstyle. Because of the expander of the GridView its not necessary to use a groupbox anymore.
My old groupstyle:
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Items, Converter={StaticResource groupDocumentsConverter}}" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<GroupBox Margin="2,20,2,25">
<GroupBox.HeaderTemplate>
<DataTemplate>
<StackPanel VirtualizingStackPanel.IsVirtualizing="True" Orientation="Horizontal" DataContext="{Binding Path=DataContext,
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GroupItem}}">
<TextBlock Text="Order " FontWeight="Bold" />
<TextBlock Text="{Binding Path=Name, StringFormat='{}{0:000000}'}" FontWeight="Bold"/>
<TextBlock Text=" - " FontWeight="Bold"/>
<TextBlock Text="{Binding Path=ItemCount}" FontWeight="Bold"/>
<TextBlock Text=" document(s)" FontWeight="Bold"/>
</StackPanel>
</DataTemplate>
</GroupBox.HeaderTemplate>
<ItemsPresenter />
</GroupBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
I searched in the documentation on internet but wasnt able to find a good solution.
The documentation points me to altering the template using Blend, but I think a faster solution should be possible?
Any help would be greatly appreciated.
Marcel
I have bought the Terelik DevCraft package and now I am working to convert some of my controls to Telerik controls.
I started with a DataGrid, this DataGrid has a GroupStyle and I am trying to apply this groupstyle to my new GridView.
The groupstyle has a converter which checks if the group contains more than 1 items, then it wil create a groupbox around the item with a header which specificies to which order the items belong. When there is only 1 item in the group there is no groupbox and no header.
I want to have the same functionality in my new GridView, my new GridView already group the items by ordernumber in an expander, I am now a bit lost on how to style the header so it shows the same information as my former groupstyle. Because of the expander of the GridView its not necessary to use a groupbox anymore.
My old groupstyle:
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Items, Converter={StaticResource groupDocumentsConverter}}" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<GroupBox Margin="2,20,2,25">
<GroupBox.HeaderTemplate>
<DataTemplate>
<StackPanel VirtualizingStackPanel.IsVirtualizing="True" Orientation="Horizontal" DataContext="{Binding Path=DataContext,
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GroupItem}}">
<TextBlock Text="Order " FontWeight="Bold" />
<TextBlock Text="{Binding Path=Name, StringFormat='{}{0:000000}'}" FontWeight="Bold"/>
<TextBlock Text=" - " FontWeight="Bold"/>
<TextBlock Text="{Binding Path=ItemCount}" FontWeight="Bold"/>
<TextBlock Text=" document(s)" FontWeight="Bold"/>
</StackPanel>
</DataTemplate>
</GroupBox.HeaderTemplate>
<ItemsPresenter />
</GroupBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
I searched in the documentation on internet but wasnt able to find a good solution.
The documentation points me to altering the template using Blend, but I think a faster solution should be possible?
Any help would be greatly appreciated.
Marcel