Glossary Item Box
You can style xamDataPresenter's™ GroupBy area by overriding the GroupByArea template. A common scenario of when you would override the GroupByArea template is when a GroupBy has been performed in code and cannot be modified by the end user.
The following procedure assumes you have a data bound xamDataPresenter, and you want to customize look of the GroupByArea. For more information, see Creating xamDataPresenter in XAML.
In XAML:
...
<Style x:Key="MyCustomGroupByArea" TargetType="igDP:GroupByArea">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="igDP:GroupByArea">
<TextBlock>The data has been grouped by
Product Name, and cannot be changed
at run time.</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
In XAML:
<igDP:XamDataPresenter x:Name="XamDataPresenter1"
...
GroupByAreaStyle="{StaticResource MyCustomGroupByArea}"/>
In XAML:
Loaded="Samp_Loaded"In Visual Basic:
Imports System.ComponentModel
Imports Infragistics.Windows.DataPresenter
...
Sub Samp_Loaded(ByVal o As Object, ByVal e As RoutedEventArgs)
Dim sd As New FieldSortDescription()
sd.FieldName = "ProductName"
sd.Direction = ListSortDirection.Ascending
sd.IsGroupBy = True
Me.XamDataPresenter1.FieldLayouts(0).SortedFields.Add(sd)
End Sub
In C#:
using System.ComponentModel;
using Infragistics.Windows.DataPresenter;
...
void Samp_Loaded(object o, RoutedEventArgs e)
{
FieldSortDescription sd = new FieldSortDescription();
sd.FieldName = "ProductName";
sd.Direction = ListSortDirection.Ascending;
sd.IsGroupBy = true;
this.XamDataPresenter1.FieldLayouts[0].SortedFields.Add(sd);
}
