windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitem-8bd89043.md
Fires when the edit value is first changed since it was last validated.
Namespace : DevExpress.XtraEditors.Repository
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Events")]
public event EventHandler Modified
<DXCategory("Events")>
Public Event Modified As EventHandler
The Modified event's data class is EventArgs.
The Modified event is raised immediately after the editor’s BaseEdit.IsModified property was set to true. This occurs when first editing the value since the last validation. You can handle the event to indicate that the current value has not been validated/saved yet. Note: you should handle the RepositoryItem.Validating event to perform actions when the edit value is accepted (to reset the unsaved state indicator, for instance).
The following sample code handles the RepositoryItem.Modified event of a MemoEdit control to make the toolBarSaveButton of the toolBar1 control enabled each time the end-user starts to change memo edit contents. The ButtonClick event is handled in order to validate the memo editor using the BaseEdit.DoValidate method and to perform specific actions in response to button click events (for example, you can save memo edit contents to a file). Once all necessary operations are performed, toolBarSaveButton is disabled.
using System.Windows.Forms;
using DevExpress.XtraEditors;
// ...
private void memoEdit1_Modified(object sender, System.EventArgs e) {
toolBarSaveButton.Enabled = true;
}
private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e) {
// Checking whether the toolBarSaveButton has been clicked
if (e.Button == toolBarSaveButton){
// Validating the memoEdit1
memoEdit1.DoValidate();
/*
*
* Here you can save the memoEdit1 contents or
* perform some other specific actions in response to button click
*/
// Making the button disabled
e.Button.Enabled = false;
}
}
Imports DevExpress.XtraEditors
' ...
Private Sub MemoEdit1_Modified(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MemoEdit1.Modified
toolBarSaveButton.Enabled = True
End Sub
Private Sub ToolBar1_ButtonClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
' Checking whether the toolBarSaveButton has been clicked
If e.Button Is toolBarSaveButton Then
' Validating the memoEdit1
MemoEdit1.DoValidate()
'
'
' Here you can save the memoEdit1 contents or
' perform some other specific actions in response to button click
'
' Making the button disabled
e.Button.Enabled = False
End If
End Sub
See Also