Thursday, September 13, 2012

Selecteditem event in MVVM silverlight

Selecteditem event in MVVM silverlight

i have a datagrid bound to a property. In this grid i have columns which consists of cells which are like hyperlink i mean when user clicks on the cell value based on these values another gird will get populated. i want to know how to get the cell value and pass it to some method so that other grid will get populated.

Answers & Comments...

Answer: 1

The best way to do this is in your viewmodel.

You should bind the SelectedItem of your datagrid to a new property in your ViewModel. In the set method of this new Property, call a new method to populate a new ObservableCollection/List/whatever...

Finally, bind your "other grid" ItemsSource to this new observable collection from your ViewModel.

Edit: If you need to load one thing or another depending on the column you are going to use the code behind, take a look at this: Silverlight DataGrid how to get cell value from a selected item?

by : zapicohttp://stackoverflow.com/users/694693




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog