I am having an issue with a custom defined datagrid with specific columns, aggregation and grouping and it does not work...well, not in C#. The grouping works 100% if defined in XAML, but its hit and miss for c#, mostly miss.
Aggregation has never worked.
I am basically generating PivotItems... which works, and then I am populating each pivot with a datagrid with the specific columns defined, as well as Grouping and Aggregation rules.
The population of the PivotItems, DataGrids and the Data all work perfectly except the Aggregation and Grouping.
I have even tried using a XAML template... also doesn't work, so I am at a loss.
Could someone please provide some tips as to what I am doing wrong.
Any help or suggestions would be greatly appreciated.
Thanks
My Code is below:
private void BuildPivots()
{
if (App.Categories != null)
{
foreach (Categories Category in App.Categories)
{
Home_PivotShell.Items.Add(new PivotItem
{
Header = Category.Name,
Name = Category.Id,
Content = new RadDataGrid
{
AutoGenerateColumns = false,
UserEditMode = DataGridUserEditMode.External,
ItemsSource = App.DataSet.Where(x => x.CategoryId == Category.Id),
GroupDescriptors =
{
new PropertyGroupDescriptor() { PropertyName = "Name", DisplayContent = "Description"}
},
AggregateDescriptors =
{
new PropertyAggregateDescriptor() { PropertyName = "Column1", Function = KnownFunction.Count}
},
Columns =
{
new DataGridTextColumn() { PropertyName = "Name", Header = "Description" },
new DataGridTextColumn() { PropertyName = "Column1" },
new DataGridTextColumn() { PropertyName = "Column2" },
new DataGridTextColumn() { PropertyName = "Column3" },
new DataGridTextColumn() { PropertyName = "Column4" },
new DataGridTextColumn() { PropertyName = "Column5" },
new DataGridTextColumn() { PropertyName = "Column6" },
new DataGridTextColumn() { PropertyName = "Column7" },
}
}
});
}
}
}
DataSource (As Requested):
NOTE: Problem is not with the datasource, I have several datasources to play with and they all do the same thing, Grouping works on XAML not on C#. Aggregation does not work at all.
namespace MyUWPApp.DataObjects
{
public class DataSet
{
public string Name { get; set; }
public string Column1 { get; set; }
public string Column2 { get; set; }
public string Column3 { get; set; }
public string Column4 { get; set; }
public string Column5 { get; set; }
public string Column6 { get; set; }
public string Column7 { get; set; }
}
}
I posted the same on the Telerik forums and got assistance which resulted in producing a working solution to my specific requirements.
If anyone is looking something similar, you can find the post here https://www.telerik.com/forums/raddatagrid-with-specific-columns-aggregation-and-grouping-in-c