ArcGIS Pro 3.7 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 ReadOnly Property IsEditingEnabled As Boolean
    public bool IsEditingEnabled {get;}

    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 SetIsEditingEnabledAsync method to enable or disable editing within the application.

    Example
    Enable Editing
    // Enables editing for the current project asynchronously.
    if (!Project.Current.IsEditingEnabled)
    {
      var bEditingIsEnabled = await Project.Current.SetIsEditingEnabledAsync(true);
    }
    Disable Editing
    // Disables editing for the current project.
    // discard any edits if they exist
    var discardEdits = true;
    // only needed if editing is enabled
    if (Project.Current.IsEditingEnabled)
    {
      // check for edits
      if (Project.Current.HasEdits)
      {
        if (discardEdits)
          await Project.Current.DiscardEditsAsync();
        else
          await Project.Current.SaveEditsAsync();
      }
      var bEditingIsEnabled = !Project.Current.SetIsEditingEnabledAsync(false).Result;
    }
    Start a single workspace edit session - Full example
    {
      // ApplicationOptions.EditingOptions.EnableEditingFromEditTab is true
      // ApplicationOptions.EditingOptions.IsSingleWorkspaceEditSession is true
    
      var project = Project.Current;
    
      // check if already editing
      if (project.IsEditingEnabled)
      {
        // save or discard any edits
        if (project.HasEdits)
        {
          var 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)
            await project.DiscardEditsAsync();
          else
            await project.SaveEditsAsync();
        }
        // close the edit session
        await project.SetIsEditingEnabledAsync(false);
      }
    
      // find a layer
      var mm = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(l => l.Name == "Roads");
      if (mm == null)
        return;
    
      // start the edit session on the workspace attached to the layer
      var success = await project.SetSingleEditWorkspaceAsync(mm);
    
      // if success = true then an edit session was started
      // and project.IsEditingEnabled will be true
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also