ArcGIS Pro SDK (三)Addin控件 2 窗格界面类

15 ArcGIS Pro 后台选项卡

15.1 添加控件

image-20240604165438745

image-20240604165633587

image-20240604170052468

15.2 Code

15.2.1 选项卡按钮

BackstageTabTestButton.cs

using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;


namespace WineMonk.Demo.ProAppModule.Code14_BackstageTab
{
    internal class BackstageTabTestButton : Button
    {
        protected override void OnClick()
        {
            MessageBox.Show("Sample action using C#.");
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">    <controls>
        <!-- add your controls here -->
        <!-- 在这里添加控件 -->
        <button id="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest_Button" caption="BackstageTabTestButton" className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestButton" loadOnClick="true">
            <tooltip heading="BackstageTab Button Heading">BackstageTab button tool tip text.<disabledText /></tooltip>
        </button>
        </controls>
    </insertModule>
</modules>
<backstage>
    <insertButton refID="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest_Button" insert="before" placeWith="esri_core_exitApplicationButton" separator="true" />
</backstage>
15.2.2 选项卡页

BackstageTabTest.xaml

<UserControl x:Class="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code14_BackstageTab"
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.BackstageTabTestViewModel}">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="20,0">
        <StackPanel>
            <TextBlock Style="{DynamicResource Esri_TextBlockBackStageTitle}" Text="{Binding TabHeading}" />
            <!-- design content for the tab here -->
        </StackPanel>
    </Grid>
</UserControl>

BackstageTabTestViewModel.cs

using ArcGIS.Desktop.Framework.Contracts;
using System.Threading.Tasks;


namespace WineMonk.Demo.ProAppModule.Code14_BackstageTab
{
    internal class BackstageTabTestViewModel : BackstageTab
    {
        /// <summary>
        /// Called when the backstage tab is selected.
        /// </summary>
        protected override Task InitializeAsync()
        {
            return base.InitializeAsync();
        }

        /// <summary>
        /// Called when the backstage tab is unselected.
        /// </summary>
        protected override Task UninitializeAsync()
        {
            return base.UninitializeAsync();
        }

        private string _tabHeading = "Tab Title";
        public string TabHeading
        {
            get
            {
                return _tabHeading;
            }
            set
            {
                SetProperty(ref _tabHeading, value, () => TabHeading);
            }
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">    
    </insertModule>
</modules>
<backstage>
    <insertTab id="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest" caption="BackstageTabTest" className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestViewModel" insert="before" placeWith="esri_core_exitApplicationButton">
        <content className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestView" />
    </insertTab>
</backstage>

16 ArcGIS Pro 窗体

16.1 添加控件

image-20240604170848719

image-20240604171004524

image-20240604171138004

16.2 Code

ShowProWindowTest.cs

using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;

namespace WineMonk.Demo.ProAppModule.Code15_ProWindow
{
    internal class ShowProWindowTest : Button
    {

        private ProWindowTest _prowindowtest = null;

        protected override void OnClick()
        {
            //already open?
            if (_prowindowtest != null)
                return;
            _prowindowtest = new ProWindowTest();
            _prowindowtest.Owner = FrameworkApplication.Current.MainWindow;
            _prowindowtest.Closed += (o, e) => { _prowindowtest = null; };
            _prowindowtest.Show();
            //uncomment for modal
            //_prowindowtest.ShowDialog();
        }

    }
}

ProWindowTest.xaml

<controls:ProWindow x:Class="WineMonk.Demo.ProAppModule.Code15_ProWindow.ProWindowTest"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
                    mc:Ignorable="d"
                    Title="ProWindowTest" Height="300" Width="300"
                    WindowStartupLocation="CenterOwner"
                    >
    <controls:ProWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </controls:ProWindow.Resources>
    <Grid>

    </Grid>
</controls:ProWindow>

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code15_ProWindow_ProWindowTest" size="large" />
            </group>
        </groups>
        <controls>
            <!-- add your controls here -->
            <!-- 在这里添加控件 -->
            <button id="WineMonk_Demo_ProAppModule_Code15_ProWindow_ProWindowTest" caption="ProWindowTest" className="WineMonk.Demo.ProAppModule.Code15_ProWindow.ShowProWindowTest" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
                <tooltip heading="Tooltip Heading">Tooltip text<disabledText /></tooltip>
            </button>
        </controls>
    </insertModule>
</modules>

17 ArcGIS Pro 属性表

17.1 添加控件

image-20240604171838970

image-20240604172349389

image-20240604172138570

17.2 Code

PropertyPageTest.xaml

<UserControl
    x:Class="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code16_PropertyPage"
    d:DataContext="{Binding Path=ui.PropertyPageTestViewModel}"
    d:DesignHeight="300"
    d:DesignWidth="300"
    mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <!--  Replace text block below with your UI components.  -->
        <TextBlock Style="{DynamicResource Esri_TextBlockRegular}" Text="{Binding DataUIContent}" />
    </Grid>
</UserControl>

PropertyPageTestViewModel.cs

using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using System;
using System.Threading.Tasks;

namespace WineMonk.Demo.ProAppModule.Code16_PropertyPage
{
    internal class PropertyPageTestViewModel : Page
    {
        /// <summary>
        /// Invoked when the OK or apply button on the property sheet has been clicked.
        /// </summary>
        /// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
        /// <remarks>This function is only called if the page has set its IsModified flag to true.</remarks>
        protected override Task CommitAsync()
        {
            return Task.FromResult(0);
        }

        /// <summary>
        /// Called when the page loads because it has become visible.
        /// </summary>
        /// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
        protected override Task InitializeAsync()
        {
            return Task.FromResult(true);
        }

        /// <summary>
        /// Called when the page is destroyed.
        /// </summary>
        protected override void Uninitialize()
        {
        }

        /// <summary>
        /// Text shown inside the page hosted by the property sheet
        /// </summary>
        public string DataUIContent
        {
            get
            {
                return base.Data[0] as string;
            }
            set
            {
                SetProperty(ref base.Data[0], value, () => DataUIContent);
            }
        }
    }

    /// <summary>
    /// Button implementation to show the property sheet.
    /// </summary>
    internal class PropertyPageTest_ShowButton : Button
    {
        protected override void OnClick()
        {
            // collect data to be passed to the page(s) of the property sheet
            Object[] data = new object[] { "Page UI content" };

            if (!PropertySheet.IsVisible)
                PropertySheet.ShowDialog("WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest", "WineMonk_Demo_ProAppModule_Code16_PropertyPage_PropertyPageTest", data);

        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest_ShowPropertySheet" size="large" />
            </group>
        </groups>
        <controls>
            <!-- add your controls here -->
            <!-- 在这里添加控件 -->
            <button id="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest_ShowPropertySheet" caption="Show PropertySheetTest" className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTest_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
                <tooltip heading="Show Property Sheet">Show Property Sheet<disabledText /></tooltip>
            </button>
        </controls>
    </insertModule>
</modules>
<propertySheets>
    <insertSheet id="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest" caption="PropertySheetTest" hasGroups="true">
        <page id="WineMonk_Demo_ProAppModule_Code16_PropertyPage_PropertyPageTest" caption="PropertyPageTest" className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTestViewModel" group="Group 1">
            <content className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTestView" />
        </page>
    </insertSheet>
</propertySheets>

18 ArcGIS Pro 窗格

18.1 添加控件

image-20240604172754534

image-20240604172851269

image-20240604173015720

18.2 Code

PaneTest.xaml

<UserControl x:Class="WineMonk.Demo.ProAppModule.Code17_Pane.PaneTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code17_Pane"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.PaneTestViewModel}">
     <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
  <Grid>
    <TextBlock Text="Add your custom content here" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
  </Grid>
</UserControl>

PaneTestViewModel.cs

using ArcGIS.Core.CIM;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using System.Threading.Tasks;

namespace WineMonk.Demo.ProAppModule.Code17_Pane
{
    internal class PaneTestViewModel : ViewStatePane
    {
        private const string _viewPaneID = "WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest";

        /// <summary>
        /// Consume the passed in CIMView. Call the base constructor to wire up the CIMView.
        /// </summary>
        public PaneTestViewModel(CIMView view)
          : base(view) { }

        /// <summary>
        /// Create a new instance of the pane.
        /// </summary>
        internal static PaneTestViewModel Create()
        {
            var view = new CIMGenericView();
            view.ViewType = _viewPaneID;
            return FrameworkApplication.Panes.Create(_viewPaneID, new object[] { view }) as PaneTestViewModel;
        }

        #region Pane Overrides

        /// <summary>
        /// Must be overridden in child classes used to persist the state of the view to the CIM.
        /// </summary>
        public override CIMView ViewState
        {
            get
            {
                _cimView.InstanceID = (int)InstanceID;
                return _cimView;
            }
        }

        /// <summary>
        /// Called when the pane is initialized.
        /// </summary>
        protected async override Task InitializeAsync()
        {
            await base.InitializeAsync();
        }

        /// <summary>
        /// Called when the pane is uninitialized.
        /// </summary>
        protected async override Task UninitializeAsync()
        {
            await base.UninitializeAsync();
        }

        #endregion Pane Overrides
    }

    /// <summary>
    /// Button implementation to create a new instance of the pane and activate it.
    /// </summary>
    internal class PaneTest_OpenButton : Button
    {
        protected override void OnClick()
        {
            PaneTestViewModel.Create();
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest_OpenButton" size="large" />
            </group>
        </groups>
        <panes>
            <pane id="WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest" caption="PaneTest" className="WineMonk.Demo.ProAppModule.Code17_Pane.PaneTestViewModel" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" defaultTab="esri_mapping_homeTab" defaultTool="esri_mapping_navigateTool">
                <content className="WineMonk.Demo.ProAppModule.Code17_Pane.PaneTestView" />
            </pane>
        </panes>
    </insertModule>
</modules>

19 ArcGIS Pro 地图窗格模拟

19.1 添加控件

image-20240604173439914

image-20240604173910273

image-20240604173848939

19.2 Code

ImpersonateMapPaneTest.xaml

<UserControl x:Class="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.ImpersonateMapPaneTestViewModel}">
     <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBlock Text="Impersonating:" Style="{DynamicResource Esri_TextBlockRegular}" FontSize="20" Margin="0,0,10,0"></TextBlock>
            <TextBlock Text="{Binding MapURI, Mode=OneWay}" Style="{DynamicResource Esri_TextBlockRegular}" FontSize="20"></TextBlock>
         </StackPanel>   
    </Grid>
</UserControl>

ImpersonateMapPaneTestViewModel.cs

using ArcGIS.Core.CIM;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Mapping;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane
{
    internal class ImpersonateMapPaneTestViewModel : TOCMapPaneProviderPane
    {
        private const string _viewPaneID = "WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest";

        /// <summary>
        /// Consume the passed in CIMView. Call the base constructor to wire up the CIMView.
        /// </summary>
        public ImpersonateMapPaneTestViewModel(CIMView view)
              : base(view)
        {
            //Set to true to change docking behavior
            _dockUnderMapView = false;
        }

        /// <summary>
        /// Create a new instance of the pane.
        /// </summary>
        internal static ImpersonateMapPaneTestViewModel Create(MapView mapView)
        {
            var view = new CIMGenericView();
            view.ViewType = _viewPaneID;
            view.ViewProperties = new Dictionary<string, object>();
            view.ViewProperties["MAPURI"] = mapView.Map.URI;
            var newPane = FrameworkApplication.Panes.Create(_viewPaneID, new object[] { view }) as ImpersonateMapPaneTestViewModel;
            newPane.Caption = $"Impersonate {mapView.Map.Name}";
            return newPane;
        }

        #region Pane Overrides

        /// <summary>
        /// Must be overridden in child classes used to persist the state of the view to the CIM.
        /// </summary>
        /// <remarks>View state is called on each project save</remarks>
        public override CIMView ViewState
        {
            get
            {
                _cimView.InstanceID = (int)InstanceID;
                //Cache content in _cimView.ViewProperties
                //((CIMGenericView)_cimView).ViewProperties["custom"] = "custom value";
                //((CIMGenericView)_cimView).ViewProperties["custom2"] = "custom value2";
                return _cimView;
            }
        }
        /// <summary>
        /// Called when the pane is initialized.
        /// </summary>
        protected async override Task InitializeAsync()
        {
            var uri = ((CIMGenericView)_cimView).ViewProperties["MAPURI"] as string;
            await this.SetMapURI(uri);
            await base.InitializeAsync();
        }

        /// <summary>
        /// Called when the pane is uninitialized.
        /// </summary>
        protected async override Task UninitializeAsync()
        {
            await base.UninitializeAsync();
        }

        #endregion Pane Overrides
    }

    /// <summary>
    /// Button implementation to create a new instance of the pane and activate it.
    /// </summary>
    internal class ImpersonateMapPaneTest_OpenButton : Button
    {
        protected override void OnClick()
        {
            ImpersonateMapPaneTestViewModel.Create(MapView.Active);
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest_OpenButton" size="large" />
            </group>
        </groups>
        <controls>
            <!-- add your controls here -->
            <!-- 在这里添加控件 -->
            <button id="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest_OpenButton" caption="Open ImpersonateMapPaneTest" className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTest_OpenButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen32.png" condition="esri_mapping_mapPane">
                <tooltip heading="Open Pane">Open Pane<disabledText /></tooltip>
            </button>
        </controls>
        <panes>
            <pane id="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest" caption="ImpersonateMapPaneTest" className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTestViewModel" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" defaultTab="esri_mapping_homeTab" defaultTool="esri_mapping_navigateTool">
                <content className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTestView" />
            </pane>
        </panes>
    </insertModule>
</modules>

20 ArcGIS Pro 停靠窗格

20.1 添加控件

image-20240604174409376

image-20240604174432702

image-20240604174623448

20.2 Code

DockpaneTest.xaml

<UserControl x:Class="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
             xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code19_Dockpane"
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.DockpaneTestViewModel}">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <DockPanel Grid.Row="0" LastChildFill="true" KeyboardNavigation.TabNavigation="Local" Height="30">
            <TextBlock Grid.Column="1" Text="{Binding Heading}" Style="{DynamicResource Esri_TextBlockDockPaneHeader}">
                <TextBlock.ToolTip>
                    <WrapPanel Orientation="Vertical" MaxWidth="300">
                        <TextBlock Text="{Binding Heading}" TextWrapping="Wrap"/>
                    </WrapPanel>
                </TextBlock.ToolTip>
            </TextBlock>
        </DockPanel>
    </Grid>
</UserControl>

DockpaneTestViewModel.cs

using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;


namespace WineMonk.Demo.ProAppModule.Code19_Dockpane
{
    internal class DockpaneTestViewModel : DockPane
    {
        private const string _dockPaneID = "WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest";

        protected DockpaneTestViewModel() { }

        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
            if (pane == null)
                return;

            pane.Activate();
        }

        /// <summary>
        /// Text shown near the top of the DockPane.
        /// </summary>
        private string _heading = "My DockPane";
        public string Heading
        {
            get { return _heading; }
            set
            {
                SetProperty(ref _heading, value, () => Heading);
            }
        }
    }

    /// <summary>
    /// Button implementation to show the DockPane.
    /// </summary>
    internal class DockpaneTest_ShowButton : Button
    {
        protected override void OnClick()
        {
            DockpaneTestViewModel.Show();
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest_ShowButton" size="large" />
            </group>
        </groups>
        <controls>
            <!-- add your controls here -->
            <!-- 在这里添加控件 -->
            <button id="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest_ShowButton" caption="Show DockpaneTest" className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTest_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
                <tooltip heading="Show Dockpane">Show Dockpane<disabledText /></tooltip>
            </button>
        </controls>
        <dockPanes>
            <dockPane id="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest" caption="DockpaneTest" className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTestViewModel" dock="group" dockWith="esri_core_projectDockPane">
                <content className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTestView" />
            </dockPane>
        </dockPanes>
    </insertModule>
</modules>

21 ArcGIS Pro 带按钮的停靠窗格

21.1 添加控件

image-20240604175000334

image-20240604175043413

image-20240604175254896

21.2 Code

ButtonDockpaneTest.xaml

<UserControl x:Class="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
             xmlns:ui="clr-namespace:WineMonk.Demo.ProAppModule.Code20_ButtonDockpane"
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"                       
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.ButtonDockpaneTestViewModel}">
  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <DockPanel Grid.Row="0" LastChildFill="true" KeyboardNavigation.TabNavigation="Local" Height="30">
      <controls:BurgerButton DockPanel.Dock="Right"
                ToolTip="{Binding BurgerButtonTooltip}"
                PopupMenu="{Binding BurgerButtonMenu}"/>
      <TextBlock Grid.Column="1" Text="{Binding Heading}" Style="{DynamicResource Esri_TextBlockDockPaneHeader}">
        <TextBlock.ToolTip>
          <WrapPanel Orientation="Vertical" MaxWidth="300">
            <TextBlock Text="{Binding Heading}" TextWrapping="Wrap"/>
          </WrapPanel>
        </TextBlock.ToolTip>
      </TextBlock>
    </DockPanel>
  </Grid>
</UserControl>

ButtonDockpaneTestViewModel.cs

using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;


namespace WineMonk.Demo.ProAppModule.Code20_ButtonDockpane
{
    internal class ButtonDockpaneTestViewModel : DockPane
    {
        private const string _dockPaneID = "WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest";
        private const string _menuID = "WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_Menu";

        protected ButtonDockpaneTestViewModel() { }

        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
            if (pane == null)
                return;

            pane.Activate();
        }

        /// <summary>
        /// Text shown near the top of the DockPane.
        /// </summary>
        private string _heading = "My DockPane";
        public string Heading
        {
            get { return _heading; }
            set
            {
                SetProperty(ref _heading, value, () => Heading);
            }
        }

        #region Burger Button

        /// <summary>
        /// Tooltip shown when hovering over the burger button.
        /// </summary>
        public string BurgerButtonTooltip
        {
            get { return "Options"; }
        }

        /// <summary>
        /// Menu shown when burger button is clicked.
        /// </summary>
        public System.Windows.Controls.ContextMenu BurgerButtonMenu
        {
            get { return FrameworkApplication.CreateContextMenu(_menuID); }
        }
        #endregion
    }

    /// <summary>
    /// Button implementation to show the DockPane.
    /// </summary>
    internal class ButtonDockpaneTest_ShowButton : Button
    {
        protected override void OnClick()
        {
            ButtonDockpaneTestViewModel.Show();
        }
    }

    /// <summary>
    /// Button implementation for the button on the menu of the burger button.
    /// </summary>
    internal class ButtonDockpaneTest_MenuButton : Button
    {
        protected override void OnClick()
        {
        }
    }
}

Config.daml

<modules>
    <insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
        <groups>
            <!-- comment this out if you have no controls on the Addin tab to avoid an empty group -->
            <!-- 如果您没有插件选项卡上的控件,请将其注释掉,以避免出现空组 -->
            <group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
                <!-- host controls within groups -->
                <!-- 组内主机控件 -->
                <button refID="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_ShowButton" size="large" />
            </group>
        </groups>
        <controls>
            <!-- add your controls here -->
            <!-- 在这里添加控件 --> 
            <button id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_MenuButton" caption="Burger Menu Button" className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTest_MenuButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
                <tooltip heading="Burger Menu Button">ToolTip<disabledText /></tooltip>
            </button>
        </controls>
        <menus>
            <menu id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_Menu" caption="Options" contextMenu="true">
                <button refID="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_MenuButton" />
            </menu>
        </menus>
        <dockPanes>
            <dockPane id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest" caption="ButtonDockpaneTest" className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTestViewModel" dock="group" dockWith="esri_core_projectDockPane">
                <content className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTestView" />
            </dockPane>
        </dockPanes>
    </insertModule>
</modules>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/716584.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

aardio实战篇) 下载微信公众号文章为pdf和html

首发地址&#xff1a; https://mp.weixin.qq.com/s/w6v3RhqN0hJlWYlqTzGCxA 前言 之前在PC微信逆向) 定位微信浏览器打开链接的call提过要写一个保存公众号历史文章的工具。这篇文章先写一个将文章保存成pdf和html的工具&#xff0c;后面再补充一个采集历史的工具&#xff0c…

python安装包中的.dist-info作用

在使用pip install 包名 进行python第三方库的时候&#xff0c;安装完库之后通常会出现一个库名&#xff0c;还有一个.dist-info的文件&#xff0c;以安装yolov8所依赖的框架ultralytics为例&#xff0c;成功安装后会出现以下文件夹&#xff1a; 第一个ultralytics是概该框架包…

移动操作系统更新管理

移动操作系统更新管理是大多数移动设备管理&#xff08;MDM&#xff09;解决方案中提供的一项功能&#xff0c;它允许组织管理移动设备上的操作系统更新。MDM解决方案定期扫描设备以检查可用的移动操作系统更新&#xff0c;并根据配置的策略管理操作系统更新。操作系统更新管理…

Java I/O操作

引言 在Java编程中&#xff0c;输入和输出&#xff08;I/O&#xff09;操作是必不可少的部分。Java I/O通过一系列流&#xff08;Stream&#xff09;类和方法&#xff0c;支持文件操作、控制台输入输出、网络I/O等多种I/O操作。本文将详细介绍Java I/O的基础概念、文件操作、字…

C++之函数重载

函数重载概念&#xff1a; 是函数的一种特殊情况&#xff0c; C 允许在 同一作用域中 声明几个功能类似 的同名函数 &#xff0c;这 些同名函数的 形参列表(参数个数 或 类型 或 类型顺序)不同 &#xff0c;常用来处理实现功能类似数据类型 不同的问题。 #include<iostre…

struts2框架漏洞

title: struts2框架漏洞 categories: 漏洞复现 abbrlink: 48203 date: 2024-06-14 15:45:27 前言知识 ognl表达式注入 对象导航图语言&#xff0c;用于访问对象的字段、方法。基于简化访问java对象属性和调用方法需求&#xff0c;实现字段类型转化等功能&#xff1b;访问列表…

详情资料SR560(斯坦福)SR570 低噪声前置放大器

SR560 低噪声前置放大器 SR560 是一款高性能、低噪声前置放大器&#xff0c;非常适合各种应用&#xff0c;包括低温测量、光学检测和音频工程。 输入 SR560 有一个差分前端&#xff0c;输入噪声为 4 nV/√Hz&#xff0c;输入阻抗为 100 MΩ。完整的噪声系数轮廓如下图所示。…

深度解析响应式异步编程模型

上一篇文章中我们聊了一下线程池,基于线程池的多线程编程是我们在高并发场景下提升系统处理效率的有效手段,但却不是唯一的。今天我们来看一下另一种异步开发的常用手段-响应式编程模型 传统多线程模型的缺陷 多线程模型是目前应用最为广泛的并发编程手段,但凡遇到什么性能…

斯坦福SR810和SR830 DSP锁定放大器

SR810 和 SR830 DSP 锁定放大器 SR810 锁定放大器和 SR830锁定放大器以合理的成本提供高性能。SR830 同时显示信号的幅度和相位&#xff0c;而 SR810 仅显示幅度。两种仪器都使用数字信号处理 (DSP) 来代替传统锁定中的解调器、输出滤波器和放大器。SR810 和 SR830 具有 1 mHz…

泛微开发修炼之旅--18泛微OA节点后操作代码自动退回流程的代码示例

文章链接&#xff1a;17泛微OA节点后操作代码自动退回流程的代码示例

6月15号作业

使用手动连接&#xff0c;将登录框中的取消按钮使用第二中连接方式&#xff0c;右击转到槽&#xff0c;在该槽函数中&#xff0c;调用关闭函数 将登录按钮使用qt4版本的连接到自定义的槽函数中&#xff0c;在槽函数中判断ui界面上输入的账号是否为"admin"&#xff0…

大型Web应用的模块化与组织实践:Flask Blueprints深入解析

目录 一、引言 二、Flask Blueprints概述 三、Flask Blueprints的使用 创建Blueprint对象 定义路由和视图函数 注册Blueprint 使用Blueprints组织代码 四、案例分析 创建模块目录结构 创建Blueprint对象 注册Blueprint 五、代码示例与最佳实践 1. 代码示例 …

Proxmox VE 超融合集群扩容后又平稳运行了170多天--不重启的话,488天了

五个节点的Proxmox VE 超融合集群&#xff0c;扩从了存储容量&#xff0c;全NVMe高速盘&#xff0c;单机4条3.7TB容量&#xff08;扩容前是两块NVMe加两块16TB的慢速SATA机械盘&#xff0c;拔掉机械盘&#xff0c;替换成两块NVMe&#xff09;&#xff0c;速度那叫一个快啊。 当…

专业酒窖的布局与设计:为红酒提供理想保存条件

对于云仓酒庄雷盛红酒的爱好者而言&#xff0c;拥有一个专业的酒窖是保存和欣赏这些珍贵佳酿的方式。一个布局合理、设计精良的专业酒窖不仅能提供稳定的保存条件&#xff0c;还能确保红酒在理想状态下陈年&#xff0c;释放其深邃的香气和口感。 首先&#xff0c;酒窖的位置选择…

胡说八道(24.6.9)——离散时间系统及simulink仿真

上回说道拉普拉斯变换的定义、性质以及在电路分析中的应用。今天先来谈谈simulink仿真&#xff0c;可为是让我非常的震惊&#xff0c;今天做了三种模型的应用。第一个是simulink中有限状态机的应用&#xff0c;用来解决一些复杂的逻辑问题&#xff0c;实现状态之间的转换。第一…

高考志愿填报选专业,把兴趣和职业进行结合!

把兴趣和职业进行结合&#xff0c;可以获取更加丰富的物质回报和精神回报。如果说兴趣因为职业化而消失&#xff0c;那么我只能说&#xff0c;这个是兴趣是假的。 一个真正的兴趣&#xff0c;应该具备以下几个问题&#xff0c;不问清楚的兴趣&#xff0c;只能叫一时兴起&#…

Clearedge3d EdgeWise 5.8 强大的自动化建模软件

EdgeWise是功能强大的建模软件&#xff0c;提供领先的建模功能和先进的技术&#xff0c;让您的整个过程更快更准确&#xff01;您可以获得使用自动特征提取和对象识别的 3D 建模&#xff0c;ClearEdge3D 自动建模和对象识别软件通过创建竣工文档和施工验证完成该过程。拓普康和…

LabVIEW、Matlab与Python的比较:从多角度详解三大编程工具

LabVIEW、Matlab和Python是工程和科学领域中常用的编程工具&#xff0c;各具特色。本文将从开发效率、计算性能、应用场景、学习曲线、成本和社区支持等多个角度&#xff0c;详细比较这三者的优缺点&#xff0c;帮助读者选择最适合其项目需求的编程工具。 比较维度 开发效率 La…

【每日LeetCode】递归、记忆化搜索

递归、记忆化搜索 【leetcode70 爬楼梯】 class Solution {public int climbStairs(int n) {int[] memo new int[n 1];return dfs(n, memo);}private int dfs(int i, int[] memo){if(i < 1){return 1;}if(memo[i] ! 0){return memo[i];}return memo[i] dfs(i-1,memo) d…

Web应用安全测试-权限缺失

Web应用安全测试-权限缺失 Flash跨域访问 漏洞描述&#xff1a;flash跨域通信&#xff0c;依据的是crossdomain.xml文件。该文件配置在服务端&#xff0c;一般为根目录下&#xff0c;限制了flash是否可以跨域获取数据以及允许从什么地方跨域获取数据。举个例子&#xff1a; 1、…