Hi,
I bind my XamDataGrid directly to an ObservableCollection of poco objects. There's a case where I need to publish an Event using EventAggregator in a property set, for example
public Decimal Amount
{
get { return amount; }
set { amountSetEvent.Publish(new AmountSetEventArgument(this, value); }
}
But I can't use the event aggregation in that POCO object. So I'm searching, if it's possible to have an OnPropertyChanging event triggered after the user updated the value and before the property is set, with access to the new value and the possibility to cancel the event so that the property is not set. Or any other suggestion are welcome.
Thanks,
Hello Dominik,
Thank you for your feedback and I am glad I helped you. I believe other community users may benefit from this as well.
Thanks again.
Hello Stefan,
Oh yes, it work,
I appreciated your help.
Dominik
I am glad I helped you. Now looking through your post I can suggest you use the e.Editor.Value to get the new Value of the Cell and e.Cell.Value to get the old one. Please let me know if you need further assistance on this matter.
Looking forward for your reply.
Hi Stefan,
Thanks for your response, almost perfect, one small thing, I can't get the new value of the field in EditModeEndingEventArgs, I can see the old value but not the edited one.
For instance if the current value is 20 and the user click the cell, edit the value to 19, out focus, I need to popup the dialog containing the edited value '19' in a textbox.
Regards,
Hello again,
I have been looking through your post and I created a sample project for you. Basically I add a window which I show on EditModeEnding event and based on the user’s choice ( Save or Cancel) I determine whether to set the value or not. I use a global variable for that purpose. Please let me know if you need any further clarifications on this matter.