Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a DataGrid with cellEditingTemplates for one of my tables that does have some Navigation properties within the columns. AutoGenerateColumns is False as I handle each one. All the Bindings are good with the cellEditingTemplates set like {Binding Path=ranks,Mode=TwoWay}, to attempt to update the DG after editing. It does not update, unless I reload it. If I try to make a wrapper class for this entity and add INotifyPropertyChanged to it the CLR states it belongs to the base class - which I see in the model. Each property seems to handle this event so why does it not change? I am using ObserableCollections(Of T) for the ItemsSource from the WCF returned ObjectSets. Any ideas? I have done some serious searches before asking here,

Setting the data:

VB
cbShift.ItemsSource = shifts 'ObservableCollection
cbShift.SelectedValuePath = "ShiftId"


Setting the selection in `CellEditEnding` - per is the Entity object casted from the `DataGrid.SelectedItem` - and is working.

VB
Dim cb = TryCast(dgStaff.CurrentColumn.GetCellContent(dgStaff.SelectedItem), ComboBox)
If Not cb Is Nothing Then
  Dim shiftId As Integer = Convert.ToInt32(cb.SelectedValue)
  per.ShiftId = shiftId
End If


I add this to the Binding: UpdateSourceTrigger=PropertyChanged and it works for the properties of the entity, but not the Navigation Properties.

Thanks for your help...
Posted
Updated 10-Dec-13 18:16pm
v2

1 solution

Here is my workaround, since no answers seem to be available.

Place the DataGrid in a ScrollViewer then when I refresh the data from the server after an edit the DataGrid does not have to move back to position 0, since it's Height is set to Auto and gets as big as it wants inside the ScrollViewer. This gives the user the experience I want - change objects and see the updated changes right where they are in the DataGrid without have to scroll back to where they were.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900