Is there any event we can listen for when the edit mode changes?
Following on, you can also get a property changed notification on IsEditingEnabled. This should fire with the edit button.
protected override void OnClick() { Project.Current.PropertyChanged += Current_PropertyChanged; } private void Current_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { //if (e.PropertyName == "HasEdits") // MessageBox.Show("HasEdits changed"); if (e.PropertyName == "IsEditingEnabled") MessageBox.Show("IsEditingEnabled changed"); }
Problem is we use Inspector class to maintain a view of an object, and when "Edit mode" changes, whole inspector nullifies the fields, and this event happens somewhere in the middle of the propagation of this change.
Any idea how to deal with this, or maybe how to formulate the question better?
Ideally when user goes from Edit to Not Edit mode, we would like the fields of inspector to stay as they are and just be read-only not emptied out.
You can check current status by calling Project.Current.IsEditingEnabled.
If you want enable/disable custom tools depending on editing status, you can use Button/MapTool conditions esri_editing_EditingPossibleCondition, esri_editing_EditingMapCondition in daml like a single condition or in addition to your conditions.
On Disabling editing EditingCompletedEvent will be raised with Discard argument.
Hi,
Thanks for quick answer.I meant event that is triggered when user interacts with EDIT button.
Main reason for asking it is, we are listening for changes in editing template, but when ESRI switches it, we don't know any more general event to listen to, to detect it.
Link to editing events in API reference:
ArcGIS.Desktop.Editing.Events Namespace Inheritance Hierarchy
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.