I'm using the RadGridView control to display an Observable collection. I also use SelectedItem="{Binding Model.CurrentRow, Mode=TwoWay}" to track which item in the list the grid pointer is on.
The first column in the grid has a textbox so the user can change the value in the grid. I subscribe to a property change event to validate the content in the textbox.
The other columns in the grid are not editable.
----
The problem:
----
When I click on any non-editable column in the grid, the grid Row highlights correctly and the "Model.CurrentRow" updates correctly. However, when I click on a textbox in the first column on a non selected row, that row does NOT receive focus. The grid row focus stays on the prevously selected row, and the "Model.CurrentRow" does not update.
How can I make the grid row focus on the selected row when i click on an editable textbox in the grid?
My partial RadGridView xaml:
<gridControls:RadGridView
........
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserFreezeColumns="False"
CanUserInsertRows="False"
IsFilteringAllowed="False"
IsReadOnly="False"
RowIndicatorVisibility="Collapsed"
SelectionUnit="FullRow"
ShowGroupPanel="False"
ItemsSource="{Binding Model.MyList}"
SelectedItem="{Binding Model.CurrentRow, Mode=TwoWay}">
<gridControls:RadGridView.Columns>
<gridControls:GridViewColumn
Header="Company Name"
IsReadOnly="True"
Width="200" >
<gridControls:GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding CompanyName, Mode=TwoWay}"/>
</DataTemplate>
</gridControls:GridViewColumn.CellTemplate>
</gridControls:GridViewColumn>
<gridControls:GridViewDataColumn
DataMemberBinding="{Binding CustomerType}"
Header="Customer Type"
IsReadOnly="True"
Width="125"
/>
...........
The first column in the grid has a textbox so the user can change the value in the grid. I subscribe to a property change event to validate the content in the textbox.
The other columns in the grid are not editable.
----
The problem:
----
When I click on any non-editable column in the grid, the grid Row highlights correctly and the "Model.CurrentRow" updates correctly. However, when I click on a textbox in the first column on a non selected row, that row does NOT receive focus. The grid row focus stays on the prevously selected row, and the "Model.CurrentRow" does not update.
How can I make the grid row focus on the selected row when i click on an editable textbox in the grid?
My partial RadGridView xaml:
<gridControls:RadGridView
........
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserFreezeColumns="False"
CanUserInsertRows="False"
IsFilteringAllowed="False"
IsReadOnly="False"
RowIndicatorVisibility="Collapsed"
SelectionUnit="FullRow"
ShowGroupPanel="False"
ItemsSource="{Binding Model.MyList}"
SelectedItem="{Binding Model.CurrentRow, Mode=TwoWay}">
<gridControls:RadGridView.Columns>
<gridControls:GridViewColumn
Header="Company Name"
IsReadOnly="True"
Width="200" >
<gridControls:GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding CompanyName, Mode=TwoWay}"/>
</DataTemplate>
</gridControls:GridViewColumn.CellTemplate>
</gridControls:GridViewColumn>
<gridControls:GridViewDataColumn
DataMemberBinding="{Binding CustomerType}"
Header="Customer Type"
IsReadOnly="True"
Width="125"
/>
...........