I have a GridView and use MVVM pattern, I bind SelectedItem to an object in my viewmodel, and on row edit ended pass this as a parameter to my insert method, as described in Telerik documentation here:
http://www.telerik.com/help/wpf/patterns-and-practices-eventtocommand-mvvmlight.html
Namely:
Here's the problem - when I first sort the grid by some field and then add a new item, the SelectedItem property on RowEditEnded event is set to an item that was the last item in the list prior to insert.
For example, I have a field SequenceNumber and sort the grid in descending order. When I insert an item, the field is blank; I then enter a very high value that would place the item to the top of the list; however, the SelectedItem parameter has the value of the last item in the list (which would be the case if no sort was initially performed). Is this a known issue? Please help.
http://www.telerik.com/help/wpf/patterns-and-practices-eventtocommand-mvvmlight.html
Namely:
<telerik:RadGridView x:Name="xRadGridView" ItemsSource="{Binding GridItems, Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="RowEditEnded"> <i:InvokeCommandAction Command="{Binding TestCommand, Mode=OneWay}" CommandParameter="{Binding ElementName=xRadGridView, Path=SelectedItem}"/> </i:EventTrigger> </i:Interaction.Triggers> </telerik:RadGridView>
Here's the problem - when I first sort the grid by some field and then add a new item, the SelectedItem property on RowEditEnded event is set to an item that was the last item in the list prior to insert.
For example, I have a field SequenceNumber and sort the grid in descending order. When I insert an item, the field is blank; I then enter a very high value that would place the item to the top of the list; however, the SelectedItem parameter has the value of the last item in the list (which would be the case if no sort was initially performed). Is this a known issue? Please help.