Can you think of a scenario where IEditableObject
would be still usefull in an MVVM-based WPF application? If so, do you have an example that demonstrates this.
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
I have used
IEditableObject
in one of my applications. For example if you have a dialog for editing something, you could implement IEditableObject on your ViewModel. You callBeginEdit()
when the dialog opens,EndEdit()
when the user clicks OK, andCancelEdit()
when the user clicks cancel.IEditableObject
is a good interface anytime you want to be able to roll back changes.I've got an implementation of
IEditableObject
in my application so that I can keep from updating my data model if what the user has entered is invalid, and roll back to the original values if the user abandons changes.Within a type being displayed in a
DataGrid
. This was needed since when I am making use of tabs and aDataGrid
is being stored within that tab switching the tabs needed to force a commit so to speak within theDataGrid
if a cell was active; rolling back the changes since they were not committed. TThere is a behavior being applied to the
DataGrid
to achieve this functionality but theIEditableObject
portion is below.