<?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: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick =&amp;quot;true&amp;quot; in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081321#M6896</link>
    <description>&lt;P&gt;for 1:&amp;nbsp;&lt;BR /&gt;you can reset the current tool to the default tool when you're done.&amp;nbsp; In the sample code that would look like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public void UpdateStatusFromAnyThread (string msg)
{
  RunOnUiThread(() =&amp;gt;
  {
	SelectionResult = msg;
        // reset the current tool to the default (explore) tool
	FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool");
  });
}&lt;/LI-CODE&gt;&lt;P&gt;for 2:&lt;/P&gt;&lt;P&gt;You can remove the ribbon reference, but not the maptool definition, so your config.daml can look like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;groups&amp;gt;
  &amp;lt;!-- comment this out if you have no controls on the Addin tab to avoid
        an empty group--&amp;gt;
  &amp;lt;group id="DockPaneWithTool_Group1" caption="Group 1" appearsOnAddInTab="true"&amp;gt;
	&amp;lt;!-- NOT NEEDED in the UI 
    &amp;lt;tool refID="DockPaneWithTool_MySelectionTool" size="large" /&amp;gt;
	--&amp;gt;
    &amp;lt;button refID="DockPaneWithTool_MyDockpane_ShowButton" size="large" /&amp;gt;
  &amp;lt;/group&amp;gt;
&amp;lt;/groups&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;but make sure that you don't remove the &amp;lt;tool ... &amp;gt; tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jul 2021 14:29:02 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-07-21T14:29:02Z</dc:date>
    <item>
      <title>Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081017#M6883</link>
      <description>&lt;P&gt;I have been trying to implement a custom sketch tool and use it from my dockpane.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came cross an example from ArcGIS-pro's community sample "Map-Exploration/IdentifyWithSketchTool" , custom identify tool link:&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/IdentifyWithSketchTool/CustomIdentify.cs" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/IdentifyWithSketchTool/CustomIdentify.cs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I see it got activated by from config.daml's &amp;lt;tool&amp;gt; tag with attribute &lt;SPAN class="pl-e"&gt;loadOnClick&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;true&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm essentially want to achieve the same behavior from my dockpane's viewmodel using a button, how can I do that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 19:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081017#M6883</guid>
      <dc:creator>LY90</dc:creator>
      <dc:date>2021-07-20T19:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081054#M6886</link>
      <description>&lt;P&gt;I assume that your dockpane code and your map tool are in the same add-in.&amp;nbsp; In this case the JIT loading/pre-loading that you refer to above (&lt;A title="Preloading a button" href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Buttons#preload-a-button" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Buttons#preload-a-button&lt;/A&gt;&amp;nbsp;) is not relevant.&amp;nbsp; Just implement your map tool (using the Button item template from the SDK) and try to use it from the button on the Pro ribbon (the default button added by the SDK template).&amp;nbsp; If the tool works as expected you can then add a button to your XAML and follow the implementation for reusing Pro buttons in MVVM:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Reusing-Pro-Commands#reusing-arcgis-pro-commands-in-mvvm" target="_blank"&gt;ProGuide Reusing Pro Commands · Esri/arcgis-pro-sdk Wiki (github.com)&amp;nbsp;&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If the tool works from your dockpane you can remove the map tool reference from config.daml in case you don't need the map tool's button to be shown on the Pro ribbon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 20:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081054#M6886</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-20T20:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081059#M6887</link>
      <description>&lt;P&gt;Thanks for replying Wolf,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good point, it seems I completely misunderstood the &lt;SPAN&gt;loadOnClick="true", thanks for your califrication.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is it possible to use the custom MapTool directly from my Viewmodel?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dockpane xaml has code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;Button Grid.Row="1" Content="Identify Feature" Command="{Binding IdentifyCommand}"/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;My Viewmodel has Icommand implementation:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;protected IdentifyDockpaneViewModel()
{
   IdentifyCommand = new RelayCommand(IdentifyClick);   
}

public ICommand IdentifyCommand { get; private set; }

private async Task IdentifyClick()
{
CustomIdentify identifyTool = new CustomIdentify ();
... (Some code goes here)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems the instance would get initiated successfully at line 10 above, but&amp;nbsp;&lt;SPAN&gt;OnSketchCompleteAsync method never got called .. Did I miss something important here?..&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 20:43:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081059#M6887</guid>
      <dc:creator>LY90</dc:creator>
      <dc:date>2021-07-20T20:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081112#M6888</link>
      <description>&lt;P&gt;I attached a sample with a tool that is instantiated from a dockpane and reports the selection results on the dockpane:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1626820210998.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18993i071921976DD40CFE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1626820210998.png" alt="Wolf_0-1626820210998.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 22:30:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081112#M6888</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-20T22:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081171#M6893</link>
      <description>&lt;P&gt;Awesome, Thanks&amp;nbsp;a lot for the code sample&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 03:56:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081171#M6893</guid>
      <dc:creator>LY90</dc:creator>
      <dc:date>2021-07-21T03:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081267#M6895</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Wolf, some additional questions on this topic..&amp;nbsp;&lt;/P&gt;&lt;P&gt;1: How do I toggle off the sketch?&amp;nbsp;&lt;/P&gt;&lt;P&gt;2: Do I always need to have the button from the daml and reference it? Can I just have it from viewmodel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 13:12:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081267#M6895</guid>
      <dc:creator>LY90</dc:creator>
      <dc:date>2021-07-21T13:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081321#M6896</link>
      <description>&lt;P&gt;for 1:&amp;nbsp;&lt;BR /&gt;you can reset the current tool to the default tool when you're done.&amp;nbsp; In the sample code that would look like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public void UpdateStatusFromAnyThread (string msg)
{
  RunOnUiThread(() =&amp;gt;
  {
	SelectionResult = msg;
        // reset the current tool to the default (explore) tool
	FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool");
  });
}&lt;/LI-CODE&gt;&lt;P&gt;for 2:&lt;/P&gt;&lt;P&gt;You can remove the ribbon reference, but not the maptool definition, so your config.daml can look like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;groups&amp;gt;
  &amp;lt;!-- comment this out if you have no controls on the Addin tab to avoid
        an empty group--&amp;gt;
  &amp;lt;group id="DockPaneWithTool_Group1" caption="Group 1" appearsOnAddInTab="true"&amp;gt;
	&amp;lt;!-- NOT NEEDED in the UI 
    &amp;lt;tool refID="DockPaneWithTool_MySelectionTool" size="large" /&amp;gt;
	--&amp;gt;
    &amp;lt;button refID="DockPaneWithTool_MyDockpane_ShowButton" size="large" /&amp;gt;
  &amp;lt;/group&amp;gt;
&amp;lt;/groups&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;but make sure that you don't remove the &amp;lt;tool ... &amp;gt; tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 14:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081321#M6896</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-21T14:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Maptool from ViewModel through XAML's button instead of config.daml with tool loadOnClick ="true"</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081438#M6900</link>
      <description>&lt;P&gt;thanks Wolf!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 17:22:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/using-maptool-from-viewmodel-through-xaml-s-button/m-p/1081438#M6900</guid>
      <dc:creator>LY90</dc:creator>
      <dc:date>2021-07-21T17:22:39Z</dc:date>
    </item>
  </channel>
</rss>

