<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get reference to view model from child control class in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197297#M8524</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I suggest you to use Esri pattern&amp;nbsp;EmbeddableControl. It has tool - dockpane connection realized already. How to use it you can found here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Using-Embeddable-Controls" target="_blank"&gt;ProGuide Using Embeddable Controls · Esri/arcgis-pro-sdk Wiki · GitHub&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 11:34:41 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2022-07-29T11:34:41Z</dc:date>
    <item>
      <title>Get reference to view model from child control class</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197181#M8519</link>
      <description>&lt;P&gt;Hi – I’m working with the ArcGIS Pro sdk 3.0 and &amp;nbsp;have a DockPane view model that contains a MapTool. I'd like to get a reference to the DockPane View Model from the MapTool class code to set some properties back on the DockPane. In the code below I’m getting an error ‘DockPane is a type, which is not valid in the given context’.&amp;nbsp; Is there a way I can correct this? I’ve seen this work getting a reference to an EmbeddableControl ViewModel in the SequentialNumberTool Sample (&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Editing/SequentialNumberTool/SeqNumTool.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Editing/SequentialNumberTool/SeqNumTool.cs&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;using ArcGIS.Desktop.Framework.Contracts;&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;internal class LandscapeSelectionTool : MapTool&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;Dockpane1ViewModel _vm;&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;protected override Task OnToolActivateAsync(bool active)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_vm = DockPane as Dockpane1ViewModel;//Error occurs here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return base.OnToolActivateAsync(active);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 23:55:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197181#M8519</guid>
      <dc:creator>PeteVitt</dc:creator>
      <dc:date>2022-07-28T23:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get reference to view model from child control class</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197200#M8520</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Dockpane" is a type, not a Dockpane instance which is what u are after.&lt;/P&gt;&lt;P&gt;cast the returned value from&amp;nbsp;FrameworkApplication.DockPaneManager.Find("dockpane_id") to your dockpane view model class. For instance:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;_vm = FrameworkApplication.DockPaneManager.Find(
                 "ProAppModule1_Dockpane1") as Dockpane1ViewModel;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is, essentially, the same thing the auto-generated code for the Dockpane item template is doing when it consrtucts its "default" Show method (to activate the dockpane in the first place).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;/// &amp;lt;summary&amp;gt;
/// Show the DockPane.
/// &amp;lt;/summary&amp;gt;
internal static void Show()
{
  DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
  if (pane == null)
    return;

  pane.Activate();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 01:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197200#M8520</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-07-29T01:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get reference to view model from child control class</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197297#M8524</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I suggest you to use Esri pattern&amp;nbsp;EmbeddableControl. It has tool - dockpane connection realized already. How to use it you can found here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Using-Embeddable-Controls" target="_blank"&gt;ProGuide Using Embeddable Controls · Esri/arcgis-pro-sdk Wiki · GitHub&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 11:34:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/get-reference-to-view-model-from-child-control/m-p/1197297#M8524</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-07-29T11:34:41Z</dc:date>
    </item>
  </channel>
</rss>

