<?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: ZoomToSelectedAsync keeps zooming in in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/zoomtoselectedasync-keeps-zooming-in/m-p/1415227#M11430</link>
    <description>&lt;P&gt;Thanks for the camera suggestion. That was a big help.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2024 10:52:35 GMT</pubDate>
    <dc:creator>EricPfirman</dc:creator>
    <dc:date>2024-04-25T10:52:35Z</dc:date>
    <item>
      <title>ZoomToSelectedAsync keeps zooming in</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/zoomtoselectedasync-keeps-zooming-in/m-p/1128648#M7535</link>
      <description>&lt;P&gt;I have a data grid holding point features and a row event handler to zoom to the feature when row is clicked. Each time a row is clicked, the map zooms to the feature but keeps zooming in. I want to have the map always zoom to 1:1,000. Each time the row is clicked, it zooms in at a ratio of&amp;nbsp; 0.56. 1,000 -&amp;gt; 563 -&amp;gt; 316 -&amp;gt; 178...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private async void ZoomToSelection(long objid)
{
	var mapView = MapView.Active;
	if (mapView == null) return;
	await QueuedTask.Run(() =&amp;gt;
	{
		FeatureLayer pLayer = MapView.Active.Map.Layers.First(layer =&amp;gt; layer.Name.Equals(Properties.Resources.permitsName)) as FeatureLayer;
		List&amp;lt;long&amp;gt; longs = new List&amp;lt;long&amp;gt; { objid };

		MapView.Active.Map.SetSelection(new Dictionary&amp;lt;MapMember, List&amp;lt;long&amp;gt;&amp;gt; { { pLayer, longs } });
		MapView.Active.ZoomToSelectedAsync();
	});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried getting the camera and setting the scale and then zooming to the new camera but the map never zooms&amp;nbsp; after the first click. On subsequent clicks, nothing happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Camera camera = new Camera();
camera = mapView.Camera;
camera.Scale = 1000;                
MapView.Active.ZoomToAsync(camera);  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT------------------------------------------------&lt;/P&gt;&lt;P&gt;If I put the camera code before I call the zoom async. I get an acceptable result. I set the scale at 1:1,785 to get close to the 1,000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcPro 2.9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:54:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/zoomtoselectedasync-keeps-zooming-in/m-p/1128648#M7535</guid>
      <dc:creator>MichaelKohler</dc:creator>
      <dc:date>2021-12-23T17:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomToSelectedAsync keeps zooming in</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/zoomtoselectedasync-keeps-zooming-in/m-p/1415227#M11430</link>
      <description>&lt;P&gt;Thanks for the camera suggestion. That was a big help.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 10:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/zoomtoselectedasync-keeps-zooming-in/m-p/1415227#M11430</guid>
      <dc:creator>EricPfirman</dc:creator>
      <dc:date>2024-04-25T10:52:35Z</dc:date>
    </item>
  </channel>
</rss>

