I'm trying to programmatically set the grouping to 2 columns that use DataTemplates, but I can't get it to work, nor can I get the drag and drop grouping to work.
I think my problem lies with the DataMemberPath, but I don't know what context it has access to at rntime, so I don't know what string to use for it.
I'm using version 2011.2.712.1040 of the RadGridView bound to an itemsource (PagedCollectionView). On AutoGeneratingColumn, I'm creating a new GridViewColumn with a DataTemplate as the CellTemplate property.
Here's the xaml for the grid:
<telerik:RadGridView telerik:Theming.Theme="Office_Blue" EnableColumnVirtualization="False" EnableRowVirtualization="False" x:Name="dgMetricContainer" ShowGroupPanel="True" Grid.Row="2" GridLinesVisibility="Both"
AutoGenerateColumns="True" AutoGeneratingColumn="dgMetricContainer_AutoGeneratingColumn" Margin="8" Grid.ColumnSpan="3" ItemsSource="{Binding MetricContainerClass.CollectionData}" FrozenColumnCount="{Binding FrozenColumnCount}" AutoExpandGroups="True"> </telerik:RadGridView>Here's the autogeneratingcolumn event where I try to set the grouping:
private void dgMetricContainer_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e) { var tempCol = new MyDataGridTemplateColumn(); tempCol.Header = header.DisplayName; tempCol.ColumnName = e.Column.UniqueName; tempCol.CellTemplate = (DataTemplate)Resources["metricContainerCellTemplate"]; tempCol.IsReadOnly = true; tempCol.IsGroupable = true; tempCol.GroupMemberPath = "???"; e.Column = tempCol; if (vm.RowSpanColumnNames.Contains(e.Column.UniqueName)) { var descriptor = new GroupDescriptor(); descriptor.Member = "StrategyAlignmentName"; descriptor.SortDirection = ListSortDirection.Ascending; dgMetricContainer.GroupDescriptors.Add(descriptor); } }I think I may be missing something fundamental here. What should my GroupMemberPath be?