ProSnippets CustomPaneWithContents - Esri/arcgis-pro-sdk GitHub Wiki

Language:              C#  
Subject:               CustomPaneWithContents  
Contributor:           ArcGIS Pro SDK Team <[email protected]>  
Organization:          Esri, http://www.esri.com  
Date:                  11/7/2025  
ArcGIS Pro:            3.6  
Visual Studio:         2022  

Snippet Create a Contents Control for a Custom View

Create a contents control to be shown as the TOC when the View is activated. The contents will be shown in the Contents Dock Pane when the IContentsProvider (i.e. your Pane) is the active pane Refer to the community sample for a complete example: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/CustomPaneWithContents

private Contents _contents;

public Contents Contents
{
  get
  {
    if (_contents == null)
    {
      //This is your user control to be used as contents
      FrameworkElement contentsControl = new CustomPaneContentsControl()
      {
        //Vanilla MVVM here
        DataContext = this//This can be any custom view model
      };

      //This is the Pro Framework contents control wrapper
      _contents = new Contents()
      {
        //The view is your user control
        ContentsView = contentsControl,
        ContentsViewModel = this,//This is your pane view model
        OperationManager = this.OperationManager//optional
      };
    }
    return _contents;
  }
}
⚠️ **GitHub.com Fallback** ⚠️