views:

14

answers:

1

I have a WPF Window with a datagrid dgSample. it has been bound to a list lstSample like this:

dgSample.itemssource=lstSample;

this datagrid also has a radio button column wherein i select one row by clicking on the radio button, and then, i can move to the next page after i click on the next button. On the next page, there is again the same datagrid, with the same radiobutton column. What I want is, that when i reach this page, i want the radio button that was selected in the previous page to be selected here as well. I have tried binding the radiobutton column with an IsSelected Property by doing:

IsChecked="{Binding Path IsSelected, Mode=TwoWay}"

but this is not working. What can I do to make it work?

P.S.: I prefer code-behind solution than the xaml one.

Please help !

+1  A: 

Your model needs to implement INotifyPropertyChanged and call

PropertyChanged(this, new PropertyChangedEventArgs("IsSelected"))

to get it to update in another view.

NB: If you set

public event PropertyChangedEventHandler PropertyChanged = delegate { };

you won't have to check for null.

Lunivore