An alternative would be an event that fires after the user clicks on the Group header, and then within the event handler, iterate through items in that group and programmatically select them. I've looked but couldn't find an event like this. Does anything event on the RadGridView catch the click on the Group Header?
I've looked through this forum for this request or someone talking about this topic, but haven't found any. Sorry, if this is repeat request.
6 Answers, 1 is accepted
I have prepared a small sample for you . Please have a look at the attached project .
Let me know if you have any troubles adapting this to your project.
Best wishes,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Pavel, excellent, thanks!
This is the code I added to your solution to select the records within the group.
private void PART_GroupExpander_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Unselect previously selected records
// ui_RadGridView.UnselectAll(); <--- Doesn't work
GroupRecord groupRecord = (GroupRecord)((GridViewExpander)sender).DataContext;
foreach (DataRecord record in groupRecord.Records.OfType<DataRecord>())
record.IsSelected =
true;
}
At this point, it only adds these records to the SelectedRecords collection, but doesn't remove the previously selected items, which I would like it to do. As described above, I tried to do call an UnselectAll() on the GridView control before selecting these items, but I guess because of the asynchronous nature of the control, the unselection happens AFTER the grouped records are selected, thus wiping out the correctly selected items.
Anyway around this?
I have touched the sample a little bit . I have added a Multiselect="true" attribute to the RadGridvView.
And I have placed your code. All now seems to work fine . Please have a look at the attachment.
Greetings,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Please have a look at the attached project . It demonstrates how to use the new API to achieve the desired behavior.
I apologize it is not Silverlight but WPF project. However as you know our controls share a common codebase and I believe the code may also run under Silverlight with almost no changes.
In case you need assistance making this work in Silverlight just drop me a line.
All the best,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.