<?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: Draw a rectangle and gather coordinates from custom usercontrol within addin in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087420#M6994</link>
    <description>&lt;P&gt;Add the MapTool to the add-in's Config.daml file but do not add it to the add-in tab.&amp;nbsp; Then in the click event of the button in your user control, set the active tool to your custom one.&amp;nbsp; There's a method, I believe on FrameworkApplication, where you can set the active tool.&amp;nbsp; This should allow the user to draw the rectangle and for you to retrieve the coordinates of that object.&lt;/P&gt;&lt;P&gt;I can't promise it will work but this is what I would personally try.&amp;nbsp; See what happens.&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
    <pubDate>Tue, 10 Aug 2021 10:35:52 GMT</pubDate>
    <dc:creator>KrisCulin</dc:creator>
    <dc:date>2021-08-10T10:35:52Z</dc:date>
    <item>
      <title>Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087410#M6993</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have an AddIn where the user gets a dialog to do some Stuff.&lt;BR /&gt;Within this dialog the user shall be able to click a button.&lt;/P&gt;&lt;P&gt;On Click the user shall be able to draw a rectangle directly on the map. After MouseRelease the coordinates of the drawn rectangle are gathered and shown in the dialog.&lt;/P&gt;&lt;P&gt;I found this sample which does almost what I want:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentifyWithDockpane" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentifyWithDockpane&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;: found another thread you told that you posted that sample. My you can help me out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem with this and all other samples I found so far about MapTool or SketchTool is that they all are added directly to the AddIn-Tab. As said I want to be able to have the click inside on of my custom usercontrols. I tried adding the corresponding XML of the MapTool to my userControl (instead of button which is there as placeholder).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;UserControl x:Class="MyProject.MyControl"
[....]&amp;gt;

    &amp;lt;UserControl.Resources&amp;gt;
        &amp;lt;ResourceDictionary&amp;gt;
            &amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;
                &amp;lt;ResourceDictionary Source="pack://application:,,,/MyProject;component\Application\Styles\Standard.xaml"/&amp;gt;
            &amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;
        &amp;lt;/ResourceDictionary&amp;gt;
    &amp;lt;/UserControl.Resources&amp;gt;
	&amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
		&amp;lt;Label Content="{x:Static resx:UiResources.DataSelection_SpatialFilter_Radio_Window}" /&amp;gt;
		&amp;lt;Button
			Style="{DynamicResource Esri_Button}"
			Command="{Binding CoordinatesByRectangleCommand}"
			ToolTip="Draw Rectangle and gather the coordinates."/&amp;gt;

		&amp;lt;tool id="MapToolIdentifyWithDockpane_MapToolIdentify" caption="Identify Features" className="MapToolIdentifyWithDockpane" loadOnClick="true" smallImage="Images\GenericButtonRed16.png" largeImage="Images\GenericButtonRed32.png" condition="esri_mapping_mapPane" keytip="z2"&amp;gt;
			&amp;lt;tooltip heading="Identify Features"&amp;gt;
				Identify features on the current map using a circular sketch.
				&amp;lt;disabledText /&amp;gt;
			&amp;lt;/tooltip&amp;gt;
		&amp;lt;/tool&amp;gt;
	&amp;lt;/StackPanel&amp;gt;
&amp;lt;/UserControl&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is, that my VS cannot resolve symbol tool.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is very difficult to find any documentary about MapTools so I am unsure whether it even is possible to call a MapTool like I wish here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, maybe there is another way to achieve getting the coordinates from a button-click within my custom usercontrol?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully there are some helping minds.&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 10:12:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087410#M6993</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-10T10:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087420#M6994</link>
      <description>&lt;P&gt;Add the MapTool to the add-in's Config.daml file but do not add it to the add-in tab.&amp;nbsp; Then in the click event of the button in your user control, set the active tool to your custom one.&amp;nbsp; There's a method, I believe on FrameworkApplication, where you can set the active tool.&amp;nbsp; This should allow the user to draw the rectangle and for you to retrieve the coordinates of that object.&lt;/P&gt;&lt;P&gt;I can't promise it will work but this is what I would personally try.&amp;nbsp; See what happens.&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 10:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087420#M6994</guid>
      <dc:creator>KrisCulin</dc:creator>
      <dc:date>2021-08-10T10:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087432#M6995</link>
      <description>&lt;P&gt;Thanks for the quick reply.&lt;BR /&gt;Unfortunately its not working. The tool is not loaded. I tried with another esri-tool which works.&lt;BR /&gt;&lt;BR /&gt;I added my tool to the daml as follows based on the tool defined here:&lt;BR /&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/MapToolIdentifyWithDockpane/Config.daml" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Exploration/MapToolIdentifyWithDockpane/Config.daml&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;ArcGIS defaultAssembly="MyProject.dll" defaultNamespace="MyProject" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd"&amp;gt;
  &amp;lt;AddInInfo id="{...}" version="1.0.0" desktopVersion="2.7.26828"&amp;gt;
    &amp;lt;Description&amp;gt;Revision ...+&amp;lt;/Description&amp;gt;
    &amp;lt;Image&amp;gt;Application\Images\Light\earthquake32.png&amp;lt;/Image&amp;gt;
    &amp;lt;Author&amp;gt;Me Author&amp;lt;/Author&amp;gt;
    &amp;lt;Company&amp;gt;Me Company&amp;lt;/Company&amp;gt;
    &amp;lt;Date&amp;gt;06.08.2021&amp;lt;/Date&amp;gt;
    &amp;lt;Subject&amp;gt;Framework&amp;lt;/Subject&amp;gt;
    &amp;lt;!-- Note subject can be one or more of these topics:
                    Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration --&amp;gt;
  &amp;lt;/AddInInfo&amp;gt;
  &amp;lt;conditions&amp;gt;
    &amp;lt;insertCondition [...]&amp;gt;
	&amp;lt;/insertCondition&amp;gt;

  &amp;lt;/conditions&amp;gt;
  &amp;lt;modules&amp;gt;
    &amp;lt;insertModule id="MyProject_Module" className="MyProjectModule" autoLoad="true" caption="MyProject-Modul"&amp;gt;
      &amp;lt;!-- uncomment to have the control hosted on a separate tab--&amp;gt;
      &amp;lt;tabs&amp;gt;
        &amp;lt;tab id="My_Project_Tab1" caption="MyProject" keytip="MyProject"&amp;gt;
          &amp;lt;group refID="My_Project_Group" /&amp;gt;
        &amp;lt;/tab&amp;gt;
      &amp;lt;/tabs&amp;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="My_Project_Group" caption="MyProject" appearsOnAddInTab="false" keytip="MyProject"&amp;gt;
          &amp;lt;!-- host controls within groups --&amp;gt;
          &amp;lt;button [...] /&amp;gt;
        &amp;lt;/group&amp;gt;
      &amp;lt;/groups&amp;gt;
      &amp;lt;controls&amp;gt;
        &amp;lt;!-- add your controls here --&amp;gt;
        &amp;lt;button [...]
        &amp;lt;/button&amp;gt;
        &amp;lt;tool id="MapToolIdentifyWithDockpane_MapToolIdentify" caption="Identify Features" className="MyProject.CoordinatesByRectangleMapTool" loadOnClick="true" smallImage="Images\GenericButtonRed16.png" largeImage="Images\GenericButtonRed32.png" keytip="z2"&amp;gt;
	        &amp;lt;tooltip heading="Identify Features"&amp;gt;
		        Identify features on the current map using a circular sketch.
		        &amp;lt;disabledText /&amp;gt;
	        &amp;lt;/tooltip&amp;gt;
        &amp;lt;/tool&amp;gt;
      &amp;lt;/controls&amp;gt;
      &amp;lt;dockPanes&amp;gt;
        &amp;lt;dockPane [...]&amp;gt;
        &amp;lt;/dockPane&amp;gt;
      &amp;lt;/dockPanes&amp;gt;
    &amp;lt;/insertModule&amp;gt;
  &amp;lt;/modules&amp;gt;
&amp;lt;/ArcGIS&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the Tool I just placed between our usual code. This also is copied from the sample mentioned above but just renamed and relocated in namespace:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;namespace MyProject
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;

    using ArcGIS.Core.Data;
    using ArcGIS.Core.Geometry;
    using ArcGIS.Desktop.Framework.Threading.Tasks;
    using ArcGIS.Desktop.Mapping;

    public class CoordinatesByRectangleMapTool : MapTool
    {
        public CoordinatesByRectangleMapTool()
        {
            IsSketchTool = true;
            SketchType = SketchGeometryType.Rectangle;
            SketchOutputMode = SketchOutputMode.Screen;
        }

        protected override Task OnToolActivateAsync(bool active)
        {
            return base.OnToolActivateAsync(active);
        }

        protected override async Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
        {
            var mv = MapView.Active;
            await QueuedTask.Run(() =&amp;gt;
            {
                // Get the features that intersect the sketch geometry. 
                // getFeatures returns a dictionary of featurelayer and a list of Object ids for each
                Dictionary&amp;lt;BasicFeatureLayer, List&amp;lt;long&amp;gt;&amp;gt; featuresObjectIds = mv.GetFeatures(geometry);

                // go through all feature layers and do a spatial query to find features 
                foreach (var featOids in featuresObjectIds)
                {
                    var featLyr = featOids.Key;
                    var qf = new QueryFilter() { ObjectIDs = featOids.Value };
                    var rowCursor = featLyr.Search(qf);
                    while (rowCursor.MoveNext())
                    {
                        using (var feat = rowCursor.Current as Feature)
                        {
                            var listOID = new List&amp;lt;long&amp;gt; { feat.GetObjectID() };
                            var displayExp = String.Join(Environment.NewLine, featLyr.QueryDisplayExpressions(listOID.ToArray()));
                            //Module1.MapToolIdentifyDockpaneVM.AddToListOfFeatures($@"Layer: {featLyr.Name} obj id: {feat.GetObjectID()} Display Expression: {displayExp}");
                            //Access all field values
                            var count = feat.GetFields().Count();
                            for (int i = 0; i &amp;lt; count; i++)
                            {
                                var val = feat[i];
                                //TODO use the value(s)
                            }
                        }
                    }
                }
            });
            return true;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The usercontrol contains a button where the command is declared as follows:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;this.CoordinatedByRectangleCommand = new GenericCommand(this.CoordinatedByRectangle);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method then tries the following code, which a copied from the sample mentioned in this thread:&lt;BR /&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-activate-deactivate-a-maptool/td-p/874112" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-activate-deactivate-a-maptool/td-p/874112&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void CoordinatedByRectangle()
{
	//CurrentTool is esri map explore
	var currentTool = FrameworkApplication.CurrentTool;
	var activeTool = FrameworkApplication.ActiveTool;
	
	//First approach
	var task = FrameworkApplication.SetCurrentToolAsync("MapToolIdentifyWithDockpane_MapToolIdentify");
	x.Wait();
	
	
	//CurrentTool still is esri map explore
	currentTool = FrameworkApplication.CurrentTool;
	activeTool = FrameworkApplication.ActiveTool;

	//Second approach
	ICommand ccmd = FrameworkApplication.GetPlugInWrapper("MapToolIdentifyWithDockpane_MapToolIdentify") as ICommand;
	if ((ccmd != null) &amp;amp;&amp;amp; ccmd.CanExecute(null))    // --&amp;gt; CanExecute results to false
		ccmd.Execute(null);
		
		
	//CurrentTool still is esri map explore
	currentTool = FrameworkApplication.CurrentTool;
	activeTool = FrameworkApplication.ActiveTool;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second approach I can see while debugging that CanExecute results to false.&lt;BR /&gt;There seems to be something wrong in the way I am doing.&lt;BR /&gt;The daml-ID seems to be correct, because in ccmd I can see the custom tooltip defined in the daml of the tool. So basically the tool can be found, but not executed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I exchange the daml-ID of my custom tool with another one from esri, like "esri_mapping_selectByRectangleTool", then the tool is changed and I directly can draw a selecting rectangle on the map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea whats wrong with my tool?&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 11:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087432#M6995</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-10T11:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087618#M6998</link>
      <description>&lt;P&gt;I modified the&amp;nbsp;MapToolIdentifyWithDockpane sample and added the selection (by rectangle) button on the same identify dockpane.&amp;nbsp; I attached the sample project, maybe this will be of help.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1628621191768.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/20567i99096BBE7A6B12B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1628621191768.png" alt="Wolf_0-1628621191768.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 18:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087618#M6998</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-08-10T18:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087646#M7001</link>
      <description>&lt;P&gt;You're totally amazing. This works great.&lt;BR /&gt;Thank you so much.&lt;BR /&gt;&lt;BR /&gt;Do you even have an idea why the canExecute results to false?&lt;BR /&gt;&lt;BR /&gt;I was wondering whether there would have been some documentation about such a thing or is it very uncommon?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 19:44:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087646#M7001</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-10T19:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087660#M7004</link>
      <description>&lt;P&gt;&lt;STRIKE&gt;Unfortunately its still not working. I thought it was because I ran your code, so it installed a second AddIn and "registered" the MapTool from your solution.&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;I put your command into place in my code. And the canExecute results true.&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;But it took the MapTool from your code to run. After I uninstalled your AddIn it is not executing anything.&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;I also renamed the damlId and all other occurences to "CoordinatesByRectangleMapTool_MapTool"&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;Seems like he is not finding my class.&lt;/STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRIKE&gt;In the daml the classname is given with&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;className="MyProject.CoordinatesByRectangleMapTool"&lt;/STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRIKE&gt;The class is with namespace MyProject and class and filename is "CoordinatesByRectangleMapTool".&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;I am missing something, but what? May you can see something? Thanks.&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem was, that my Tools Class was in another project than the daml. Although I full qualified it. Even the class from your addin was found. Well, I dont get it, but after I moved the class into the main-project it worked.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:40:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087660#M7004</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-10T22:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087753#M7008</link>
      <description>&lt;P&gt;The MapTool gets a geometry as parameter.&lt;/P&gt;&lt;P&gt;The geometry has no spatialReference and so the coordinates are screen-coordinates starting in the top left with 0/0.&lt;BR /&gt;&lt;BR /&gt;How do I convert them into coordinates of a specific spatialReference (by given wkid)?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 23:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087753#M7008</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-10T23:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087765#M7009</link>
      <description>&lt;P&gt;Ok guess I found also a solution that for but I am unsure if thats the correct way.&lt;/P&gt;&lt;P&gt;I changed SketchOutput to Map instead of Screen.&lt;BR /&gt;And then convert the geometries coordinates to the desired spatial Reference as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
{
	//Get Map-Coordinates
	var extend = geometry.Extent;
	var xMin = extend.XMin;
	var xMax = extend.XMax;
	var yMin = extend.YMin;
	var yMax = extend.YMax;

	//Create desired SpatialReference
	var displaySpatialReference = SpatialReferenceBuilder.CreateSpatialReference(31466);
	
	//Create MapPoints with desired SpatialReference from Map-Coordinates
	var topRight = MapPointBuilder.CreateMapPoint(xMax, yMax, displaySpatialReference);
	var bottomLeft = MapPointBuilder.CreateMapPoint(xMin, yMin, displaySpatialReference);
	
	//Gather new xMin, xMax, yMin, yMax
	var xMin2 = bottomLeft.X;
	var xMax2 = topRight.X;
	var yMin2 = bottomLeft.Y;
	var yMax2 = topRight.Y;

	//Put new Coordinates into dialog
	BasicFilterVm.Current.SpatialFilterWindowMaxHigh = yMax2;
	BasicFilterVm.Current.SpatialFilterWindowMinHigh = yMin2;
	BasicFilterVm.Current.SpatialFilterWindowMaxRight = xMax2;
	BasicFilterVm.Current.SpatialFilterWindowMinRight = xMin2;
	
	return true;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that fine or is there a better way to achieve that?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 00:44:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1087765#M7009</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-11T00:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088004#M7016</link>
      <description>&lt;P&gt;You can change the&amp;nbsp;SketchOutputMode in your tool to SketchOutputMode.Map.&amp;nbsp; This should get you the sketch geometry in the same spatial reference as your map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public MapToolIdentifyWithDockpane()
{
    IsSketchTool = true;
    SketchType = SketchGeometryType.Rectangle;
    SketchOutputMode = SketchOutputMode.Map;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you need to project your geometry using a different coordinate system you can use GeometryEngine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var geomProjected = GeometryEngine.Instance.Project(geometry, SpatialReferences.WebMercator);
                        &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 17:13:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088004#M7016</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-08-11T17:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088185#M7022</link>
      <description>&lt;P&gt;Works fine thx.&lt;BR /&gt;Yet another question.&lt;BR /&gt;How can I make the tool work only once?&lt;BR /&gt;&lt;BR /&gt;So after using it once the previous or any default tool should be loaded.&lt;BR /&gt;&lt;SPAN&gt;If the user wants to use the tool again, she should click the button again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 22:11:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088185#M7022</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-11T22:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088197#M7023</link>
      <description>&lt;P&gt;Looks like this works to restore the mapexplore als default.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        protected override async Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
        {
            [...]

            var cmd = FrameworkApplication.GetPlugInWrapper("esri_mapping_exploreTool") as ICommand;
            if ((cmd != null) &amp;amp;&amp;amp; cmd.CanExecute(null))    // --&amp;gt; CanExecute results to false
            {
                cmd.Execute(null);
            }

            return true;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that fine or is there a better way to perfom?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 22:46:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088197#M7023</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-08-11T22:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a rectangle and gather coordinates from custom usercontrol within addin</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088209#M7024</link>
      <description>&lt;P&gt;Use FrameworkApplication.SetCurrentToolAsync to set the current tool using the tool's daml id.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// pass the tool's daml id as parameter
FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool");&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Aug 2021 23:40:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/draw-a-rectangle-and-gather-coordinates-from/m-p/1088209#M7024</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-08-11T23:40:41Z</dc:date>
    </item>
  </channel>
</rss>

