当前位置: 首页 > news >正文

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

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

目录

  • ArcGIS Pro SDK (三)Addin控件 2 窗格界面类
    • 15 ArcGIS Pro 后台选项卡
      • 15.1 添加控件
      • 15.2 Code
        • 15.2.1 选项卡按钮
        • 15.2.2 选项卡页
    • 16 ArcGIS Pro 窗体
      • 16.1 添加控件
      • 16.2 Code
    • 17 ArcGIS Pro 属性表
      • 17.1 添加控件
      • 17.2 Code
    • 18 ArcGIS Pro 窗格
      • 18.1 添加控件
      • 18.2 Code
    • 19 ArcGIS Pro 地图窗格模拟
      • 19.1 添加控件
      • 19.2 Code
    • 20 ArcGIS Pro 停靠窗格
      • 20.1 添加控件
      • 20.2 Code
    • 21 ArcGIS Pro 带按钮的停靠窗格
      • 21.1 添加控件
      • 21.2 Code

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

<UserControlx: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 sheetObject[] 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>

相关文章:

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

ArcGIS Pro SDK &#xff08;三&#xff09;Addin控件 2 窗格界面类 目录 ArcGIS Pro SDK &#xff08;三&#xff09;Addin控件 2 窗格界面类15 ArcGIS Pro 后台选项卡15.1 添加控件15.2 Code15.2.1 选项卡按钮15.2.2 选项卡页 16 ArcGIS Pro 窗体16.1 添加控件16.2 Code 17 A…...

Ubuntu 20.04.6 LTS系统使用命令编辑静态IP地址【笔记】

rootubuntu-machine:/home# cat /etc/issue Ubuntu 20.04.6 LTS \n \l1、切换到root身份 sudo su2、编辑静态IP地址&#xff0c;示例以01-network-manager-all.yaml&#xff0c;个别系统可能是00-network-manager-all.yaml&#xff0c;以安装系统生成的文件为准。 vim /etc/n…...

Python第二语言(八、Python包)

目录 1. 什么是Python包 2. 创包步骤 2.1 new包 2.2 查看创建的包 2.3 拖动文件到包下 3. 导入包 4. 安装第三方包 4.1 什么是第三方包 4.2 安装第三方包-pip 4.3 pip网络优化 1. 什么是Python包 包下有__init__.py就是包&#xff0c;无__init__.py就是文件夹。于Ja…...

Pipeline流水线组件

文章目录 1、新建pipeline流水线2、定义处理器3、定义处理器上下文4、pipeline流水线实现5、处理器抽象类实现6、pipeline流水线构建者7、具体处理器实现8、流水线测试9、运行结果 1、新建pipeline流水线 package com.summer.toolkit.model.chain;import java.util.List; impo…...

闪灵CMS电子商城系统源码v5.0(自带微信小程序)

源码介绍 闪灵CMS电子商城系统源码&#xff0c;双语带手机版&#xff0c;PHPMYSQL进行开发&#xff0c;网站安装简单、快捷。 闪灵CMS系统更新日志 1.修复&#xff1a;修复了开启强制https后&#xff0c;说明文档重定向过多的问题 2.修复&#xff1a;修复了商品名称过长时无…...

基于SSM的旅游民宿预定系统【源码】【运行教程】

基于SSM的旅游民宿预定系统 一、项目介绍1. 游客功能2. 管理员功能3. 高级功能 二、项目技术栈三、项目运行四、项目演示总结 大家好&#xff0c;这里是程序猿代码之路&#xff01;随着旅游业的快速发展&#xff0c;民宿作为一种独特的住宿方式越来越受到游客的喜爱。为了提升用…...

PgSQL技术内幕 - psql与服务端连接与交互机制

PgSQL技术内幕 - 客户端psql与服务端连接与交互机制 简单来说&#xff0c;PgSQL的psql客户端向服务端发起连接请求&#xff0c;服务端接收到请求后&#xff0c;fork出一个子进程&#xff0c;之后由该子进程和客户端进行交互&#xff0c;处理客户端的SQL等&#xff0c;并将结果返…...

实现开发板三盏灯点亮熄灭

实现开发板三盏灯点亮熄灭 typedef struct {volatile unsigned int MODER; // 0x00volatile unsigned int OTYPER; // 0x04volatile unsigned int OSPEEDR; // 0x08volatile unsigned int PUPDR; // 0x0Cvolatile unsigned int IDR; // 0x10volatile unsigned int OD…...

外汇天眼:盈透证券为客户提供更丰富的欧洲衍生品交易渠道

电子交易巨头盈透证券&#xff08;纳斯达克代码&#xff1a;IBKR&#xff09;今日宣布&#xff0c;通过Cboe欧洲期权交易所&#xff08;CEDX&#xff09;新增欧洲股票期权和欧洲指数期货及期权。这一新增功能使得盈透证券的客户可以在单一统一平台上&#xff0c;除了股票、期权…...

论文阅读Rolling-Unet,卷积结合MLP的图像分割模型

这篇论文提出了一种新的医学图像分割网络Rolling-Unet&#xff0c;目的是在不用Transformer的前提下&#xff0c;能同时有效提取局部特征和长距离依赖性,从而在性能和计算成本之间找到良好的平衡点。 论文地址&#xff1a;https://ojs.aaai.org/index.php/AAAI/article/view/2…...

Linux Shell命令vim使用

一、引例 以判断引出&#xff08;学过C其他语言容易接受&#xff09;。 简单命令说明&#xff1a; -e 测试文件是否存在 -f 测试文件是否为普通文件 -d 测试文件是否为目录 -r 测试当前用户对某文件是否具有“可读”权限 -w 测试当前用户对某文件是否具有“可写”权限…...

如何将 API 管理从 Postman 转移到 Apifox

上一篇推文讲到用 Swagger 管理的 API 怎么迁移到 Apifox&#xff0c;有许多同学反馈说能不能介绍一下 Postman 的迁移以及迁移过程中需要注意的事项。那么今天&#xff0c;它来了&#xff01; 从 Postman 迁移到 Apifox 的方法有两种&#xff1a; 导出 Postman 集合 &#x…...

用链表实现的C语言队列

一、队列概述 在数据结构中&#xff0c;队列是一种先进先出&#xff08;FIFO&#xff09;的线性表。它在许多应用场景中非常有用&#xff0c;例如任务调度、进程管理、资源管理等。队列是一种重要的数据结构&#xff0c;其主要特点是先进先出&#xff08;FIFO, First In First …...

国产SDI视频均衡驱动器,功能与 LMH0387/LMH0344 一致

视频均衡驱动器&#xff0c;功能与 LMH0387 一致、LMH0344。本期间支持 DVB-ASI&#xff0c;作为驱动器能够选择输出速率&#xff0c;作为均衡接收器能支持100m以上传输距离&#xff08;线缆类型Belden 1694A&#xff09;。最大支持3Gbps 速率的信号 2 产品特征 a&#xff09…...

如何用Xinstall CPS结算系统打破传统营销桎梏,实现用户增长?

在互联网流量红利逐渐衰退的今天&#xff0c;App推广和运营面临着前所未有的挑战。如何快速搭建起满足用户需求的运营体系&#xff0c;成为了众多企业急待解决的问题。而在这个关键时刻&#xff0c;Xinstall CPS结算系统应运而生&#xff0c;以其独特的优势帮助企业解决了一系列…...

(代数:解一元二次方程)可以使用下面的公式求一元二次方程 ax2+bx+c0 的两个根:

(代数:解一元二次方程)可以使用下面的公式求一元二次方程 ax2bxc0 的两个根: b2-4ac 称作一元二次方程的判别式。如果它是正值,那么一元二次方程就有两个实数根。 如果它为 0&#xff0c;方程式就只有一个根。如果它是负值&#xff0c;方程式无实根。 编写程序&#xff0c;提示…...

如何提高网站收录?

GSI服务就是专门干这个的&#xff0c;这个服务用的是光算科技自己研发的GPC爬虫池系统。这个系统通过建立一个庞大的站群和复杂的链接结构&#xff0c;来吸引谷歌的爬虫。这样一来&#xff0c;你的网站就能更频繁地被谷歌的爬虫访问&#xff0c;从而提高被收录的机会。 说到效…...

Docker 学习总结(83)—— 配置文件daemon.json介绍及优化建议

一、daemon.json 文件概述 daemon.json是Docker守护进程的配置文件,它允许系统管理员自定义Docker守护程序的行为。此文件通常位于/etc/docker/目录下。通过修改daemon.json,可以调整Docker守护进程的多种设置,包括网络配置、日志记录、存储驱动等。 二、daemon.json 文件结…...

Javaweb04-Servlet技术2(HttpServletResponse, HttpServletRequest)

Servlet技术基础 HttpServletResponse对象 HttpServletResponce对象是继承ServletResponse接口&#xff0c;专门用于封装Http请求 HttpServletResponce有关响应行的方法 方法说明功能描述void setStatus(int stauts)用于设置HTTP响应消息的状态码&#xff0c;并生成响应状态…...

chat gpt基本原理解读

chat gpt基本原理解读 ChatGPT是一种基于生成式预训练变换器&#xff08;Generative Pre-trained Transformer, GPT&#xff09;的对话模型&#xff0c;主要通过大量的文本数据训练生成自然语言回复。以下是ChatGPT的基本原理解读&#xff1a; 1. 基本架构 ChatGPT 是基于 GPT…...

web vue 项目 Docker化部署

Web 项目 Docker 化部署详细教程 目录 Web 项目 Docker 化部署概述Dockerfile 详解 构建阶段生产阶段 构建和运行 Docker 镜像 1. Web 项目 Docker 化部署概述 Docker 化部署的主要步骤分为以下几个阶段&#xff1a; 构建阶段&#xff08;Build Stage&#xff09;&#xff1a…...

C++初阶-list的底层

目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

安宝特方案丨XRSOP人员作业标准化管理平台:AR智慧点检验收套件

在选煤厂、化工厂、钢铁厂等过程生产型企业&#xff0c;其生产设备的运行效率和非计划停机对工业制造效益有较大影响。 随着企业自动化和智能化建设的推进&#xff0c;需提前预防假检、错检、漏检&#xff0c;推动智慧生产运维系统数据的流动和现场赋能应用。同时&#xff0c;…...

Golang dig框架与GraphQL的完美结合

将 Go 的 Dig 依赖注入框架与 GraphQL 结合使用&#xff0c;可以显著提升应用程序的可维护性、可测试性以及灵活性。 Dig 是一个强大的依赖注入容器&#xff0c;能够帮助开发者更好地管理复杂的依赖关系&#xff0c;而 GraphQL 则是一种用于 API 的查询语言&#xff0c;能够提…...

el-switch文字内置

el-switch文字内置 效果 vue <div style"color:#ffffff;font-size:14px;float:left;margin-bottom:5px;margin-right:5px;">自动加载</div> <el-switch v-model"value" active-color"#3E99FB" inactive-color"#DCDFE6"…...

【OSG学习笔记】Day 16: 骨骼动画与蒙皮(osgAnimation)

骨骼动画基础 骨骼动画是 3D 计算机图形中常用的技术&#xff0c;它通过以下两个主要组件实现角色动画。 骨骼系统 (Skeleton)&#xff1a;由层级结构的骨头组成&#xff0c;类似于人体骨骼蒙皮 (Mesh Skinning)&#xff1a;将模型网格顶点绑定到骨骼上&#xff0c;使骨骼移动…...

技术栈RabbitMq的介绍和使用

目录 1. 什么是消息队列&#xff1f;2. 消息队列的优点3. RabbitMQ 消息队列概述4. RabbitMQ 安装5. Exchange 四种类型5.1 direct 精准匹配5.2 fanout 广播5.3 topic 正则匹配 6. RabbitMQ 队列模式6.1 简单队列模式6.2 工作队列模式6.3 发布/订阅模式6.4 路由模式6.5 主题模式…...

视觉slam十四讲实践部分记录——ch2、ch3

ch2 一、使用g++编译.cpp为可执行文件并运行(P30) g++ helloSLAM.cpp ./a.out运行 二、使用cmake编译 mkdir build cd build cmake .. makeCMakeCache.txt 文件仍然指向旧的目录。这表明在源代码目录中可能还存在旧的 CMakeCache.txt 文件,或者在构建过程中仍然引用了旧的路…...

JVM 内存结构 详解

内存结构 运行时数据区&#xff1a; Java虚拟机在运行Java程序过程中管理的内存区域。 程序计数器&#xff1a; ​ 线程私有&#xff0c;程序控制流的指示器&#xff0c;分支、循环、跳转、异常处理、线程恢复等基础功能都依赖这个计数器完成。 ​ 每个线程都有一个程序计数…...