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

All ProSnippets listed here are also used by the following sample code: CustomPaneWithContents sample code

Language:              C#  
Subject:               Map-Exploration  
Contributor:           ArcGIS Pro SDK Team <[email protected]>  
Organization:          esri, http://www.esri.com  
Date:                  10/22/2024  
ArcGIS Pro:            3.4  
Visual Studio:         2022  
.NET Target Framework: .Net 8  

CustomPaneViewModel

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

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** ⚠️