Windows Forms binding allows you to discard changes made in a data item (row/record). This feature is available for data objects that implement IEditableObject (CurrencyManager.CancelCurrentEdit).
Entity Framework 4 comes with POCO support that allows developers to define entities (base classes are not required). By not inheriting from the underlying entities of the framework, developers lost the built-in implementations of IEditableObject
and INotifyPropertyChanged
interfaces (for example, the capability to undo changes to a grid control if data validation fails).
This example demonstrates how to address this issue at the GridView level. The example creates a custom Grid View. The custom GridView uses a new data controller (inherited from the CurrencyDataController
class) and overrides the following methods: BeginCurrentRowEdit
, EndCurrentRowEdit
, and CancelCurrentRowEdit
.
- Form1.cs (VB: Form1.vb)
- CancellingChangesDataController.cs (VB: CancellingChangesDataController.vb)
- GridControlEx.cs (VB: GridControlEx.vb)
- GridViewEx.cs (VB: GridViewEx.vb)
- GridViewExInfoRegistrator.cs (VB: GridViewExInfoRegistrator.vb)
- GridViewExOptionsBehavior.cs (VB: GridViewExOptionsBehavior.vb)
- Person.cs (VB: Person.vb)
(you will be redirected to DevExpress.com to submit your response)