ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / IsEditingEnabled Property
Example

In This Topic
    IsEditingEnabled Property
    In This Topic
    Gets a value that indicates if editing is enabled.
    Syntax
    public bool IsEditingEnabled {get;}
    Public ReadOnly Property IsEditingEnabled As Boolean

    Property Value

    True if editing is enabled; otherwise, false.
    Remarks
    While this value is true, all editing tools and feature templates are enabled; otherwise, they are disabled. While this value is false, EditOperations will fail. Use the ArcGIS.Desktop.Core.Project.SetIsEditingEnabledAsync method to enable or disable editing within the application.
    Example
    Enable Editing
    // if not editing
    if (!Project.Current.IsEditingEnabled)
    {
      var res = MessageBox.Show("You must enable editing to use editing tools. Would you like to enable editing?",
                                                            "Enable Editing?", System.Windows.MessageBoxButton.YesNoCancel);
      if (res == System.Windows.MessageBoxResult.No ||
                    res == System.Windows.MessageBoxResult.Cancel)
      {
        return;
      }
      Project.Current.SetIsEditingEnabledAsync(true);
    }
    
    Disable Editing
    // if editing
    if (Project.Current.IsEditingEnabled)
    {
      var res = MessageBox.Show("Do you want to disable editing? Editing tools will be disabled",
                                                             "Disable Editing?", System.Windows.MessageBoxButton.YesNoCancel);
      if (res == System.Windows.MessageBoxResult.No ||
                    res == System.Windows.MessageBoxResult.Cancel)
      {
        return;
      }
    
      //we must check for edits
      if (Project.Current.HasEdits)
      {
        res = MessageBox.Show("Save edits?", "Save Edits?", System.Windows.MessageBoxButton.YesNoCancel);
        if (res == System.Windows.MessageBoxResult.Cancel)
          return;
        else if (res == System.Windows.MessageBoxResult.No)
          Project.Current.DiscardEditsAsync();
        else
        {
          Project.Current.SaveEditsAsync();
        }
      }
      Project.Current.SetIsEditingEnabledAsync(false);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also