I have added one column as <telerik:GridViewSelectColumn/> so that the user will have the option to select/unselect all the rows at a time. Now I want to access the rows which user has marked as checked on this column.
<telerik:RadGridView SelectionMode="Extended" ItemsSource="{Binding FilterDataGridRows}" SelectedItem="{Binding SelectedData,Mode=TwoWay}"
Doing something like this...but this is not working...
It is suggested on this side to use some dependency property to get the SelectedItems.....
Is there any easy way to achieve the selected rows ??
5 Answers, 1 is accepted
May I ask you to clarify whether you would like to access the data items bound to the rows being selected or the GridViewRows themselves?
Regards,
Didie
Telerik
Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).
Yes , I want to access the dataitems bound to the rows which are marked as selected.
Thank you for clarifying.
You can check this github example on how to bind the SelectedItems to a collection from your view model. Although GitHub is a very well-known platform we saw a better and easier approach for reviewing our examples developing our brand new SDK Samples Browser. You can also use it to review the examples.
Regards,
Didie
Telerik
Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).
Hello,
Picking up on this thread since I have kind of the same problem.
I looked at the example, which was very good, but the difference in my case is that instead of having all the xaml-code in 1 MainWindow, I have 2 User Controls put in the MainWindow. Using the example you supplied, that would mean that the RadGridView would be in the first UserControl, and the ListView would be in the second one.
If we look at my case, in both of my user controls I have a RadGridView in each, and when I select a row in the first one, the second one should get the id from the selected row in the first one, and use that for a database call to get the data that should be displayed in the second UserControl/RadGridView.
I tried to use your example with a SelectedItemsBindingBehavior class, but I just can't get it to work.
Any help is appreciated.
Thanks,
Peter Centellini
If I understood your requirements correctly, I do not believe that using this implementation of the SelectedItemsBindingBehavior will be sufficient in this case.
What you could do, however, is to handle the first RadGridView's SelectionChanged event and use the SelectionChangeEventArgs' AddedItems and RemovedItems to set the second RadGridView's DataContext and/or ItemsSource respectively.
Please let me know whether such an approach would work for you.
Regards,
Dilyan Traykov
Telerik by Progress