below is my datagrid's definition:
<DataGrid
Name="ODataGrid"
AutoGenerateColumns="False"
Grid.Row="0"
Grid.Column="0"
CanUserAddRows="False"
AlternationCount="2"
HeadersVisibility="All"
IsReadOnly="True"
SelectionUnit="FullRow"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#EBF0F0"
AlternatingRowBackground="#E9E8EF"
HorizontalGridLinesBrush="#7F7F7F"
VerticalGridLinesBrush="#7F7F7F"
SelectedItem="{Binding vmItem}"
CellStyle="{StaticResource ODataGridCellStyle}"
ItemsSource="{Binding vmResults}"
Tag="{Binding DataContext, ElementName=BaseGrid}">
Below are the steps I took to get the error.
- The first row was selected by default.
- I select another row in the datagrid.
- I do a sort by clicking on one of the column header.
- I do a scroll by dragging the vertical scroll bar.
- The initial first row was somehow auto selected.
- So now, there are 2 rows being selected.
Why this behaviour? Anyway to prevent the auto select on scroll? Thanks.