DoubleGroupDescription
In this article we will show you how to use DoubleGroupDescription with your numeric data.
DoubleGroupDescription
When using LocalDataSourceProvider you can choose between three types of group description - PropertyGroupDescription, DoubleGroupDescription and DateTimeGroupDescription (or implement your own group description, which inherits PropertyGroupDescriptionBase).
DoubleGroupDescription is used when you want to group your data by numeric property. DoubleGroupDescription has the following properties:
PropertyName - defines the name of the property by which the data will be grouped. It is mandatory to set a value.
Step - defines the grouping interval. It is a double property with default value 100.
<pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
<pivot:DoubleGroupDescription PropertyName="Quantity" />
<pivot:DoubleGroupDescription PropertyName="Quantity" Step="200" />
</pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
DoubleGroupDescription doubleGroupDescription1 = new DoubleGroupDescription();
doubleGroupDescription1.PropertyName = "Quantity";
DoubleGroupDescription doubleGroupDescription2 = new DoubleGroupDescription();
doubleGroupDescription2.PropertyName = "Quantity";
doubleGroupDescription2.Step = 200;
var dataProvider = new LocalDataSourceProvider();
dataProvider.ColumnGroupDescriptions.Add(doubleGroupDescription1);
dataProvider.ColumnGroupDescriptions.Add(doubleGroupDescription2);
Dim doubleGroupDescription1 As New DoubleGroupDescription()
doubleGroupDescription1.PropertyName = "Quantity"
Dim doubleGroupDescription2 As New DoubleGroupDescription()
doubleGroupDescription2.PropertyName = "Quantity"
doubleGroupDescription2.Step = 200
Dim dataProvider = New LocalDataSourceProvider()
dataProvider.ColumnGroupDescriptions.Add(doubleGroupDescription1)
dataProvider.ColumnGroupDescriptions.Add(doubleGroupDescription2)
You may also create a PropertyGroupDescription instead of DoubleGroupDescription - this way the numeric data will be treated as a string and will be grouped and sorted as such. However by using PropertyGroupDescription you will loose the grouping interval feature of the DoubleGroupDescription (the Step property).
Change Step at Run Time
With the Q1 2015 release version of UI for WPF, the Step of each DoubleGroupDescription can be also customized through a dedicated UI dialog. The dialog is accessible through the context menu of each DoubleGroupDescription.