Skip to content

ProSnippets CustomPaneWithContents

UmaHarano edited this page May 6, 2024 · 15 revisions

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 <arcgisprosdk@esri.com>  
Organization:          esri, http://www.esri.com  
Date:                  1/2/2024  
ArcGIS Pro:            3.3  
Visual Studio:         2022  
.NET Target Framework: .Net 6  

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;
  }
}

Home

ProSnippets: CustomPaneWithContents

CustomPaneViewModel

Clone this wiki locally