I've a DataGrid with 5 columns. First 3 columns are part of parent object and last 2 columns are part of child object. I've a userName column as 6th column.
When I update anything from first 3 columns of parent object, userName reflects correctly. But when I update anything from last 2 columns of child object, it doesn't update the userName.
I've tried binding it and doing logic in child object and before 'save' userName updates correctly for last 2 columns but after save it reverts back to previous userName.
My question is, how do I keep the updated userName after save?
XAML:
<DataGridTextColumn Header="Updated By" IsReadOnly="True" Binding="{Binding ChildObject.UpdatedUser, UpdateSourceTrigger=PropertyChanged}"/>
Child Object:
public string UpdatedUser
{
get
{
var parent = this.CrawlParentFindType<ParentObject>();
if (Column4IsDirtyByValue || Column5IsDirtyByValue)
return UpdatedByUserName;
else return parent.UpdatedByUserName;
}
}
public bool Column4IsDirtyByValue { get { return FieldManager.IsFieldDirty(Column4Property); } }
public bool Column5IsDirtyByValue{ get { return FieldManager.IsFieldDirty(Column5Property); } }
public string Column4
{
get { return GetProperty(Column4Property); }
set { SetProperty(Column4Property, value); OnPropertyChanged(x => x.UpdatedUser); }
}
public string Column5
{
get { return GetProperty(Column5Property); }
set { SetProperty(Column5Property, value); OnPropertyChanged(x => x.UpdatedUser); }
}