Is it possible to display text values in the cells or does it have to be numerical only? I don't need any totals or aggregates. I have managed to get the control to display my rows and columns correctly, but I'm not sure how to get it to display the values I need since they are text values.
I want to use this control because I don't know how many columns I will need and its much simpler to matrix my data and let the control figure it out. I could achieve the same results with a GridView, manually adding columns and using a converter to find the correct values, but it would be MUCH simpler to use a PivotGrid.
I have attached an image of what I'm trying to display. My class and data are below.
public class SettingCompareMatrix : IComparable<SettingCompareMatrix>
{
public int SettingGroupIndex { get; set; }
public string SettingGroup { get; set; }
public int SettingIndex { get; set; }
public string SettingName { get; set; }
public string Name { get; set; }
public string Value { get; set; }
//For sorting the rows, instead of by alphebetical order. Another issue to figure out!
public int CompareTo(SettingCompareMatrix other)
{
if (this.SettingGroupIndex > other.SettingGroupIndex)
return 1;
else if (this.SettingGroupIndex < other.SettingGroupIndex)
return -1;
else
{
if (this.SettingIndex > other.SettingIndex)
return 1;
else if (this.SettingIndex < other.SettingIndex)
return -1;
else
return 0;
}
}
}
private List<SettingCompareMatrix> GeneratePivotData()
{
return new List<SettingCompareMatrix>()
{
new SettingCompareMatrix() { SettingGroupIndex = 0, SettingGroup="Store", SettingIndex=0, SettingName="Create Store", Name="Store 1", Value="True" },
new SettingCompareMatrix() { SettingGroupIndex = 0, SettingGroup="Store", SettingIndex=0, SettingName="Create Store", Name="Store 2", Value="False" },
new SettingCompareMatrix() { SettingGroupIndex = 0, SettingGroup="Store", SettingIndex=1, SettingName="Information", Name="Store 1", Value="Modify" },
new SettingCompareMatrix() { SettingGroupIndex = 0, SettingGroup="Store", SettingIndex=1, SettingName="Information", Name="Store 2", Value="Display" },
new SettingCompareMatrix() { SettingGroupIndex = 1, SettingGroup="Categories", SettingIndex=0, SettingName="Category", Name="Store 1", Value="Add" },
new SettingCompareMatrix() { SettingGroupIndex = 1, SettingGroup="Categories", SettingIndex=0, SettingName="Category", Name="Store 2", Value="Display" },
new SettingCompareMatrix() { SettingGroupIndex = 2, SettingGroup="Supplier", SettingIndex=0, SettingName="Information", Name="Store 1", Value="Display" },
new SettingCompareMatrix() { SettingGroupIndex = 2, SettingGroup="Supplier", SettingIndex=0, SettingName="Information", Name="Store 2", Value="Add" },
new SettingCompareMatrix() { SettingGroupIndex = 2, SettingGroup="Supplier", SettingIndex=1, SettingName="Settings Price Matrix", Name="Store 1", Value="Add" },
new SettingCompareMatrix() { SettingGroupIndex = 2, SettingGroup="Supplier", SettingIndex=1, SettingName="Settings Price Matrix", Name="Store 2", Value="Display" },
};
}
<pivot:LocalDataSourceProvider x:Key="LocalDataProvider" AggregatesPosition="Rows" >
<pivot:LocalDataSourceProvider.RowGroupDescriptions>
<pivot:PropertyGroupDescription PropertyName="SettingGroup" />
<pivot:PropertyGroupDescription PropertyName="SettingName" />
</pivot:LocalDataSourceProvider.RowGroupDescriptions>
<pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
<pivot:PropertyGroupDescription PropertyName="Name" />
</pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
<pivot:LocalDataSourceProvider.AggregateDescriptions>
<pivot:PropertyAggregateDescription PropertyName="Value"/>
</pivot:LocalDataSourceProvider.AggregateDescriptions>
</pivot:LocalDataSourceProvider>
<pivot:RadPivotGrid Grid.Row="1" DataProvider="{StaticResource LocalDataProvider}"
ColumnGrandTotalsPosition="None" ColumnSubTotalsPosition="None"
RowGrandTotalsPosition="None" RowSubTotalsPosition="None" />