Hi Kamesh,
The following code snippet addresses your issue to display the first row of group items into the group header control.
For example:
<DataTemplate x:Key="groupingComboBoxItemTemplate"
DataType="local:GroupingItem">
<TextBlock Text="{Binding Description}"
Margin="2,0,6,0"/>
</DataTemplate>
<ControlTemplate x:Key="groupExpanderToggleButtonTemplate"
TargetType="ToggleButton">
<ContentPresenter x:Name="expanderGlyphPresenter"
Content="{x:Null}"
ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).CollapseGroupGlyph}" />
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="False">
<Setter TargetName="expanderGlyphPresenter"
Property="ContentTemplate"
Value="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).ExpandGroupGlyph}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<xcdg:IntAdditionConverter x:Key="groupHeaderControlGroupLevelConverter" />
<ControlTemplate x:Key="customtableViewGroupHeaderControlTemplate"
TargetType="xcdg:GroupHeaderControl">
<!-- Using this decorator will prevent the GroupHeaderControl of exceeding the width
defined by the grid's column. -->
<xcdg:PassiveLayoutDecorator Axis="Horizontal">
<!-- This DockPanel is used to layout the GroupLevelIndicatorPane placeholder and the GroupHeaderControl Content. -->
<DockPanel>
<!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
whenever this GroupHeaderControl is part of a group. -->
<xcdg:HierarchicalGroupLevelIndicatorPane DockPanel.Dock="Left" />
<xcdg:GroupLevelIndicatorPane DockPanel.Dock="Left"
Indented="False"
xcdg:GroupLevelIndicatorPane.GroupLevel="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(xcdg:GroupLevelIndicatorPane.GroupLevel), Converter={StaticResource groupHeaderControlGroupLevelConverter}, ConverterParameter=-1}" />
<!-- Main Border for the GroupHeaderControl. It is Focusable to make the InputBindings work. -->
<Border x:Name="mainBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Focusable="True"
FocusVisualStyle="{TemplateBinding FocusVisualStyle}">
<!-- Define all the standard InputBindings for a GroupHeaderControl. -->
<Border.InputBindings>
<KeyBinding Command="{x:Static xcdg:DataGridCommands.ToggleGroupExpansion}"
Key="Space" />
<KeyBinding Command="{x:Static xcdg:DataGridCommands.ExpandGroup}"
Key="Right" />
<KeyBinding Command="{x:Static xcdg:DataGridCommands.ExpandGroup}"
Key="Add" />
<KeyBinding Command="{x:Static xcdg:DataGridCommands.CollapseGroup}"
Key="Left" />
<KeyBinding Command="{x:Static xcdg:DataGridCommands.CollapseGroup}"
Key="Subtract" />
<MouseBinding Command="{x:Static xcdg:DataGridCommands.ToggleGroupExpansion}"
MouseAction="LeftDoubleClick" />
</Border.InputBindings>
<!-- This StackPanel is used to layout the ToggleButton and the GroupHeaderControl. -->
<StackPanel Orientation="Horizontal">
<!-- ToggleButton that is used to expand/collapse the group. -->
<ToggleButton Template="{StaticResource groupExpanderToggleButtonTemplate}"
OverridesDefaultStyle="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Group.IsExpanded}"
Margin="-15"/>
<!-- ContentPresenter in charge of displaying this GroupHeaderControl's Content, which is
a Group by default. -->
<local:customDataRow cvg="{Binding RelativeSource={RelativeSource Self},Path=(xcdg:DataGridControl.StatContext)}" />
</StackPanel>
</Border>
</DockPanel>
</xcdg:PassiveLayoutDecorator>
<ControlTemplate.Triggers>
<Trigger Property="xcdg:DataGridControl.NavigationBehavior"
Value="None">
<Setter TargetName="mainBorder"
Property="Focusable"
Value="False" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="xcdg:GroupHeaderControl">
<Setter Property="Template"
Value="{StaticResource customtableViewGroupHeaderControlTemplate}" />
</Style>
public class customDataRow : Xceed.Wpf.DataGrid.Row
{
#region cvg Property
public static readonly DependencyProperty cvgProperty = DependencyProperty.Register(
"cvg",
typeof( CollectionViewGroup ),
typeof( customDataRow ),
new FrameworkPropertyMetadata(
null,
new PropertyChangedCallback( customDataRow.OncvgChanged ) ) );
public CollectionViewGroup cvg
{
get
{
return ( CollectionViewGroup )this.GetValue( customDataRow.cvgProperty );
}
set
{
this.SetValue( customDataRow.cvgProperty, value );
}
}
private static void OncvgChanged( DependencyObject sender, DependencyPropertyChangedEventArgs e )
{
}
#endregion
public customDataRow()
{
this.ReadOnly = true;
}
protected override Cell CreateCell( ColumnBase column )
{
Cell _Cell = new Cell();
if( cvg != null )
{
_Cell.Content = ( ( System.Data.DataRowView )cvg.Items[ 0 ] ).Row[ column.FieldName ];
}
else
{
_Cell.FieldName = column.FieldName;
_Cell.Content = column.Title;
}
return _Cell;
}
protected override bool IsValidCellType( Cell cell )
{
bool validity = true;
return validity;
}
}
Xceed - Software Developer and Technical Support