Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RepositoryItem.Modified Event

Fires when the edit value is first changed since it was last validated.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Events")]
public event EventHandler Modified

#Event Data

The Modified event's data class is EventArgs.

#Remarks

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).

#Example

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;
   }
}
See Also