-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditCellConfirmationBehavior.vb
More file actions
26 lines (21 loc) · 1 KB
/
EditCellConfirmationBehavior.vb
File metadata and controls
26 lines (21 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Imports DevExpress.Mvvm.UI.Interactivity
Imports DevExpress.Xpf.Grid
Imports System.Windows
Namespace GridControlCellEditingConfirmationExample
Public Class EditCellConfirmationBehavior
Inherits Behavior(Of TableView)
Protected Overrides Sub OnAttached()
MyBase.OnAttached()
AddHandler AssociatedObject.ValidateCell, AddressOf AssociatedObject_ValidateCell
End Sub
Private Sub AssociatedObject_ValidateCell(ByVal sender As Object, ByVal e As GridCellValidationEventArgs)
If Equals(e.Column.FieldName, NameOf(Item.Growth)) AndAlso MessageBox.Show("Do you wish to update the value?", "Confirmation", MessageBoxButton.YesNo) = MessageBoxResult.No Then
AssociatedObject.HideEditor()
End If
End Sub
Protected Overrides Sub OnDetaching()
RemoveHandler AssociatedObject.ValidateCell, AddressOf AssociatedObject_ValidateCell
MyBase.OnDetaching()
End Sub
End Class
End Namespace