ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / LayoutSnapping Class / SetSnapModes Method
a collection of LayoutSnapMode parameters
Example

In This Topic
    SetSnapModes Method (LayoutSnapping)
    In This Topic

    Sets the given snapping modes.

    Syntax
    public static void SetSnapModes( 
       IEnumerable<LayoutSnapMode> modes
    )
    Public Shared Sub SetSnapModes( _
       ByVal modes As IEnumerable(Of LayoutSnapMode) _
    ) 

    Parameters

    modes
    a collection of LayoutSnapMode parameters
    Remarks
    This method disables the current snapping modes and enables the given snapping modes. It is intended to efficiently set one or more snapping modes.
    Example
    Configure Snapping - Application SnapModes
    // sets only the Guide snapping mode 
    ArcGIS.Desktop.Layouts.LayoutSnapping.SetSnapModes(new[] { LayoutSnapMode.Guide });
    // sets only Element and Page snapping modes
    ArcGIS.Desktop.Layouts.LayoutSnapping.SetSnapModes(new[] { LayoutSnapMode.Element, LayoutSnapMode.Page }); 
    
    // clear all snap modes
    ArcGIS.Desktop.Layouts.LayoutSnapping.SetSnapModes(null);
    
    
    // set snap modes one at a time
    ArcGIS.Desktop.Layouts.LayoutSnapping.SetSnapMode(LayoutSnapMode.Margins, true);
    ArcGIS.Desktop.Layouts.LayoutSnapping.SetSnapMode(LayoutSnapMode.Guide, true);
    /// LayoutSnapping.SetSnapModes(new[]{ LayoutSnapMode.Guide }); // sets only the Guide snapping mode 
    
    // get current snap modes
    var snapModes = ArcGIS.Desktop.Layouts.LayoutSnapping.SnapModes;
    
    // get state of a specific snap mode
    bool isOn = ArcGIS.Desktop.Layouts.LayoutSnapping.GetSnapMode(LayoutSnapMode.Guide);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also