Hi guys!
I've got a problem with databinding of SelectedRecords property of RadGridView.
In my application I'm using MVVM pattern. So I need to bind ViewModel selectedItems to SelectedRecords of RadGridView to notify my ViewModel about selection changes (I'm using multiple selection).
When I'm trying to bind SelectedRecords property my browsers shutdowns (both IE and Mozilla).
Best regards,
Alexey Zakharov.
I've got a problem with databinding of SelectedRecords property of RadGridView.
In my application I'm using MVVM pattern. So I need to bind ViewModel selectedItems to SelectedRecords of RadGridView to notify my ViewModel about selection changes (I'm using multiple selection).
When I'm trying to bind SelectedRecords property my browsers shutdowns (both IE and Mozilla).
Best regards,
Alexey Zakharov.
5 Answers, 1 is accepted
0
Hi Alexey,
SelectedRecords is collection property with get only access. This is why you cannot bind it (it cannot be assigned). You should attach handler to SelectionChanged event and synchronize it with your SelectedItems collection.
Let us know if you need more information.
Greetings,
Hristo
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.
SelectedRecords is collection property with get only access. This is why you cannot bind it (it cannot be assigned). You should attach handler to SelectionChanged event and synchronize it with your SelectedItems collection.
Let us know if you need more information.
Greetings,
Hristo
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.
0
Alexey
Top achievements
Rank 2
answered on 05 Jun 2009, 05:33 PM
=( That is bad. Are you planning to create 100% MVVM frendly controls in future?
0
Hello Alexey,
In case you would like your ViewModel to be notified of any selection changes there should be no problem binding your ViewModel's selected records to RadGridView.SelectedRecords collection. For example, there is no problem to display the selected items in a ListView control - the binding looks like that:
Unfortunately it is impossible to update the RadGridView.SelectedRecords collection through a similar TwoWay binding. I am affraid that such scenarios are not supported by any ItemsControl, even in WPF.
In case you are having troubles with the first scenario you can send us more info like any error messages, etc so that we can help you solve the problem.
Sincerely yours,
Milan
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.
In case you would like your ViewModel to be notified of any selection changes there should be no problem binding your ViewModel's selected records to RadGridView.SelectedRecords collection. For example, there is no problem to display the selected items in a ListView control - the binding looks like that:
Binding binding = new Binding("SelectedRecords"); |
binding.Mode = BindingMode.OneWay; |
binding.Source = this.RadGridView1; |
this.view.SetBinding(ListView.ItemsSourceProperty, binding); |
Unfortunately it is impossible to update the RadGridView.SelectedRecords collection through a similar TwoWay binding. I am affraid that such scenarios are not supported by any ItemsControl, even in WPF.
In case you are having troubles with the first scenario you can send us more info like any error messages, etc so that we can help you solve the problem.
Sincerely yours,
Milan
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.
0
0
Hi Alexey,
Thanks for sharing your solution on our forums.
Best wishes,
Milan
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.
Thanks for sharing your solution on our forums.
Best wishes,
Milan
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.