views:

342

answers:

0

Hi, I'm trying to write a master - detail control that consists of a master datagrid and the detail datagrid. My scenario was following - I used the SelectedItem and bound it to a property in ModelView. The problem is - the SelectedItem in ViewModel is never used, so I can't get the information which item is selected in a master datagrid and cannot fetch the data for thos selection.

The code is below:

<toolkit:DataGrid ItemsSource="{Binding}"  RowDetailsVisibilityMode="VisibleWhenSelected" SelectedItem="{Binding SelectedItemHandler, Mode=TwoWay}"></toolkit:DataGrid>

And in ViewModel

private CustomerObjects _selectedItem;    
public CustomerObjects SelectedItemHandler {
                get { return _selectedItem; }
                set
                {
                         OnPropertyChanged("SelectedItem");

                }

            }

The code in SelectedItemHandler is never used. What could be the problem? Should I use another approach to create master - detail in MVVM?