ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / MapSeries Property
Example

In This Topic
    MapSeries Property (Layout)
    In This Topic
    Gets the map series associated with a layout.
    Syntax
    public MapSeries MapSeries {get;}
    Public ReadOnly Property MapSeries As MapSeries
    Remarks
    A layout can only have one map series set at a time.
    Example
    LayoutEvent_MapSeries
    //Report the event args when the map series properties have changed.
    
    //At 2.x - ArcGIS.Desktop.Layouts.Events.MapSeriesEvent.Subscribe((args) =>
    //{
    //  System.Windows.MessageBox.Show("MapSeriesEvent:" +
    //  Environment.NewLine +
    //  "   arg CurrentPageName: " + args.CurrentPageName.ToString() +
    //  Environment.NewLine +
    //  "   arg CurrentlPageNumber: " + args.CurrentPageNumber.ToString() +
    //  Environment.NewLine +
    //  "   arg Layout: " + args.Layout.Name +
    //  Environment.NewLine +
    //  "   arg Type: " + args.Type.ToString());
    //});
    
    ArcGIS.Desktop.Layouts.Events.LayoutEvent.Subscribe((args) =>
    {
      var layout = args.Layout;
      if (args.Hint == LayoutEventHint.MapSeriesRefreshed ||
        args.Hint == LayoutEventHint.MapSeriesPageChanged)
      {
        var ms = layout.MapSeries;
        System.Diagnostics.Debug.WriteLine($"LayoutEvent {args.Hint.ToString()}: {layout.Name}");
      }
    });
    
    MapSeries_FindPageNumber
    //Return the page number that corresponds to the page name field for an index feature
    
    Layout layout = LayoutView.Active.Layout;
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      SpatialMapSeries SMS = layout.MapSeries as SpatialMapSeries;
      Row msRow = SMS.CurrentRow;
      System.Windows.MessageBox.Show(SMS.FindPageNumber(msRow.GetOriginalValue(msRow.FindField("NAME")).ToString()));
    });
    MapSeries_GetSetDefinition
    //Get and modify a map series CIM definition and set the changes back to the layout
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      MapSeries MS = layout.MapSeries as MapSeries;
      CIMMapSeries CIM_MS = MS.GetDefinition();
      CIM_MS.Enabled = false;
      MS.SetDefinition(CIM_MS);
      layout.SetMapSeries(MS);
    });
    MapSeries_SetCurrentPageNumber
    //Set the current page to match a specific page number
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      MapSeries MS = layout.MapSeries as MapSeries;
      MS.SetCurrentPageNumber("IV");
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also