This is a migrated thread and some comments may be shown as answers.

[Solved] Getting ColumnGroupDescriptor when Grouping is set programmatically

2 Answers 220 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Patrick
Top achievements
Rank 1
Patrick asked on 12 Feb 2011, 08:55 PM
Hello,

I'm trying to get a handle to the column[s] currently being grouped when the grouping is set programmatically. It's easy to get ColumnGroupDescriptor (which is great btw) when grouping is done via the UI. As in:
IEnumerable<ColumnGroupDescriptor> groups = grid.GroupDescriptors.OfType<ColumnGroupDescriptor>();
foreach (ColumnGroupDescriptor group in groups)
{
    //Do something...
}

When I programmatically add a group as in:
grid.GroupDescriptors.Add(new Telerik.Windows.Data.GroupDescriptor() { Member = "Category" });

I don't get the convenient list of ColumnGroupDescriptor during the OfType conversion (just an empty list), GroupDescriptors contains only a basic GroupDescriptor which doesn't seem to contain much or include the column. Is there a way that I'm missing to acquire the ColumnGroupDescriptor when I do this OR do you have another way to get an easy handle to the column, or perhaps the column's UniqueName? Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 14 Feb 2011, 08:58 AM
Hi,

 You should add ColumnGroupDescriptor instead plain GroupDescriptor to achieve your goal. 

All the best,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Patrick
Top achievements
Rank 1
answered on 14 Feb 2011, 05:19 PM
Ah, of course! Exactly what I should have done. I created my ColumnGroupDescriptor, assigned my column to it and added the ColumnGroupDescriptor to the GroupDescriptors. Thanks Vlad,

Patrick
Tags
GridView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or