<?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 Prevent FeatureDataGrid from selecting the first row after panning the map in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/prevent-featuredatagrid-from-selecting-the-first/m-p/680995#M17511</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know how I can prevent the first row in the FeatureDataGrid from being selected after a panning action has been performed on the Map?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When my application starts, nothing is selected in the FeatureDataGrid. But as soon as I pan the map, the first row in the FeatureDataGrid is selected. I can repeat this behavior in the sample found here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the sample this behavior happens only once, but in my application it continues selecting the first row after panning, even if I clear the selection in between the panning actions. The 'first row selection' does not happen when I zoom in or out on the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Jan 2011 11:23:38 GMT</pubDate>
    <dc:creator>MarkJagt</dc:creator>
    <dc:date>2011-01-17T11:23:38Z</dc:date>
    <item>
      <title>Prevent FeatureDataGrid from selecting the first row after panning the map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/prevent-featuredatagrid-from-selecting-the-first/m-p/680995#M17511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know how I can prevent the first row in the FeatureDataGrid from being selected after a panning action has been performed on the Map?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When my application starts, nothing is selected in the FeatureDataGrid. But as soon as I pan the map, the first row in the FeatureDataGrid is selected. I can repeat this behavior in the sample found here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the sample this behavior happens only once, but in my application it continues selecting the first row after panning, even if I clear the selection in between the panning actions. The 'first row selection' does not happen when I zoom in or out on the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 11:23:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/prevent-featuredatagrid-from-selecting-the-first/m-p/680995#M17511</guid>
      <dc:creator>MarkJagt</dc:creator>
      <dc:date>2011-01-17T11:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent FeatureDataGrid from selecting the first row after panning the map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/prevent-featuredatagrid-from-selecting-the-first/m-p/680996#M17512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Mark,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your posting. We are currently looking into this problem. In the meantime you can have a variable to keep track of the selection count whenever there is a change in your feature layer graphics collection AND the selection in your layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You should clear the selection when:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. There was no selection in your layer previously, AND&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Current selection count is equal to 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your code whould be something similar to the following code snippet:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; selectedCount; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 2; font-family: Consolas;"&gt;// Variable to keep track of the selection count in FeatureLayer&lt;/SPAN&gt;
&lt;SPAN style="color: #008000; font-size: 2; font-family: Consolas;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;public&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; YourUserControlClassConstructor()&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;{&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; InitializeComponent();&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; &lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;
&lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; FeatureLayer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; featureLayer = MyMap.Layers[&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 2; font-family: Consolas;"&gt;"MyFeatureLayer"&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; featureLayer.Graphics.CollectionChanged += Graphics_CollectionChanged;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; selectedCount = featureLayer.SelectionCount;&lt;/SPAN&gt;
&lt;/SPAN&gt;}
 
&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;private&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; Graphics_CollectionChanged(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;object&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; sender, System.Collections.Specialized.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 2; font-family: Consolas;"&gt;NotifyCollectionChangedEventArgs&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; e)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;{&lt;/SPAN&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; if&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt; (selectedCount == 0 &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 2; font-family: Consolas;"&gt;&lt;SPAN style="color: #008000; font-size: 2; font-family: Consolas;"&gt;/* No selections before */&lt;/SPAN&gt;
&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; MyDataGrid.SelectedItems.Count == 1 &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 2; font-family: Consolas;"&gt;/* Unwanted selection after the change in graphics collection */&lt;/SPAN&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; MyDataGrid.SelectedItems.Clear();&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;&amp;nbsp; selectedCount = MyDataGrid.SelectedItems.Count;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 2; font-family: Consolas;"&gt;}&lt;/SPAN&gt;
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:40:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/prevent-featuredatagrid-from-selecting-the-first/m-p/680996#M17512</guid>
      <dc:creator>AliMirzabeigi</dc:creator>
      <dc:date>2021-12-12T04:40:17Z</dc:date>
    </item>
  </channel>
</rss>

