I have a simple DataGrid
<DataGrid AutoGenerateColumns="False"
ItemsSource="{Binding Items, Mode=TwoWay}"
CanUserAddRows="True" CanUserDeleteRows="True"
SelectionMode="Single"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" SelectionUnit="FullRow" >
<DataGridTextColumn Header="Name"
Binding="{Binding Path=Name, Mode=TwoWay}"
CellStyle="{StaticResource CellDefaultStyle}" />
</DataGrid>
I use it on a Page
in a NavigationWindow
. When I open the page and navigate to another page then all is fine.
But when I open the page and select a row in the DataGrid and then navigate to another page then I get the error:
Cannot change cell selection when the SelectionUnit is FullRow.
But I want to keep the FullRow
selection unit.