Take the 2-minute tour ×

I've looked and can't quite find what I'm looking for. I have a MVVM environment. On the View model, I have a Datatable available from data from a database connection/query. I've exposed a property (getter/setter) as a "DataView" based on "TheTable.DefaultView".

I have a datagrid in the window that binds to the dataview... no problem.

<DataGrid AutoGenerateColumns="False" 
   ItemsSource="{Binding Path=ViewModelViewProperty, 
   SelectedItem="{Binding Path=JustOneRecordInView, Mode=TwoWay}"
   CanUserAddRows="False" >

For the "SelectedItem" above, it too comes from a property exposed on the ViewModel via its (getter/setter).

Now, my problem. As I scroll down the list of records in the data grid, I have other textbox controls to show more data than just the grid listing provides. I want to be able to edit the data of "the current row", so I have a textbox with as many settings as I can think of, but something is still amiss.

   Text="{Binding Path=PropertyForCurrentRecord[SpecificColumnInDataViewRow], 
    Name="textBox1" VerticalAlignment="Top" Width="40" />

If I scroll though and am in an edit mode of the data, and change the value in the textbox associated with the current row, AND this value is one of the columns being displayed in the grid, the datagrid itself DOES NOT show the changed value. However, if I DO continue to scroll off and back on the same record, the value in the textbox DOES show the changed to value.

So, how can I force that the grid data source is considered updated too as the individual column from the specific row has changed, and the grid itself updated too. Thanks...

share|improve this question
add comment

2 Answers

Your datagrid is bound to a collection of some elements of type SomeType. To make your task you need to implement INotifyPropertyChanged in the SomeType (or inherit from ViewModelBase if you have it). You can take a look at a good sample here: http://www.hightech.ir/SeeSharp/best-implementation-of-inotifypropertychange-ever

share|improve this answer
Sorry I did not clarify, I do have an INotifyPropertyChanged implementation when the "row selected" changes... However, shouldn't the data grid be presenting the content of the dataviewrow which is being updated... –  DRapp Dec 7 '11 at 17:30
add comment
up vote 0 down vote accepted

WOW... after a bunch more digging from the days prior, I finally cracked it and here is how I fixed it.

private bool AcceptingTheChanges = false;
private DataRowView myRecord;
public DataRowView MyRecord
   get { return myRecord; }
   set {
          if (myRecord != null)

          // Now, get the incoming value and re-store into private
          myRecord = value;
          // Finally, raise event that it changed to refresh window...
share|improve this answer
add comment

Your Answer


