<?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: ArgumentNullException (center) in Map.zoomAbout() clicking on map with no tile la in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68106#M1695</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for reporting this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you can do to avoid the exception is to prevent a zoom on double-click when map does not contain any layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
void MyMap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
 e.Handled = MyMap.Layers.Count == 0;
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:37:08 GMT</pubDate>
    <dc:creator>JenniferNery</dc:creator>
    <dc:date>2021-12-10T22:37:08Z</dc:date>
    <item>
      <title>ArgumentNullException (center) in Map.zoomAbout() clicking on map with no tile layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68105#M1694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArgumentNullException (center) in Map.zoomAbout() clicking on map with no tile layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using the Silverlight API v2.1 with Silverlight 4 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If we have a map which currently only contains (empty) graphics layers (no tile layers) and the user clicks on the blank map, you get an ArgumentNullException for the "center" parameter of the Map.zoomAbout() method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;While we have the map defined in xaml, we've removed the &lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;ArcGISTiledMapServiceLayer &lt;/SPAN&gt;&lt;SPAN&gt;from xaml because we have to wait a while to determine what URL we want to connect the layer to (and it seems you cannot leave the layer's Url property blank or null when specified in xaml.) Once we know the URL, we create the layer in code behind and add it to the map's layers collection. This part works fine; the problem is simply the ArgumentNullException. It seems to be occurring in some M&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;ouseLeftButtonUp handler that is internal to the map (that is the method that appears to be calling map.zoomAbout()); we tried adding our own empty left button handler but that didn't fix the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We'd rather not create the map in code behind, as we have a bunch of stuff within the map element. Is there a way to avoid this exception?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 18:47:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68105#M1694</guid>
      <dc:creator>AndySanford</dc:creator>
      <dc:date>2011-03-10T18:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: ArgumentNullException (center) in Map.zoomAbout() clicking on map with no tile la</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68106#M1695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for reporting this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you can do to avoid the exception is to prevent a zoom on double-click when map does not contain any layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
void MyMap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
 e.Handled = MyMap.Layers.Count == 0;
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68106#M1695</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T22:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArgumentNullException (center) in Map.zoomAbout() clicking on map with no tile la</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68107#M1696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, Jennifer,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a bunch, that works!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also found that I can disable the map (map.IsEnabled = false) to prevent the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 12:49:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/argumentnullexception-center-in-map-zoomabout/m-p/68107#M1696</guid>
      <dc:creator>AndySanford</dc:creator>
      <dc:date>2011-03-11T12:49:48Z</dc:date>
    </item>
  </channel>
</rss>

