<?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: Problem to zoom to selected graphic for the feature datagrid. in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171126#M4215</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you subscribe to FeatureDataGrid.SelectionChanged event, be sure to use FeatureDataGrid.SelectedGraphics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try the following code with SDK sample &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid&lt;/A&gt;&lt;SPAN&gt;. Notice that the OBJECTID's of current data grid selection are printed on your OutputWindow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private void MyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
 if (MyDataGrid == null || MyDataGrid.SelectedGraphics == null) return;
 System.Diagnostics.Debug.WriteLine("begin selection");
 foreach (var g in MyDataGrid.SelectedGraphics)
&amp;nbsp; System.Diagnostics.Debug.WriteLine(g.Attributes["OBJECTID"]);
 System.Diagnostics.Debug.WriteLine("end selection");
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:52:02 GMT</pubDate>
    <dc:creator>JenniferNery</dc:creator>
    <dc:date>2021-12-11T08:52:02Z</dc:date>
    <item>
      <title>Problem to zoom to selected graphic for the feature datagrid.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171125#M4214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a feature data grid with a feature layer binding to it. I am trying to code to let user click on one item in this feature data grid, and the map zoom to this selected feature. However, in the SelectionChanged event handler, the FeatureLayerObject.SelectedGraphics always returns the previous feature been selected (i.e., first time, the SelectedGraphics after click on any item in the feature data grid is null, and second time the SelectedGraphics returns the first feature that was just been selected). This makes that I can't get the geometry of current selected feature form this SelectedGraphics attribute. Has anyone encounter the same problem before?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help in advance!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2011 20:21:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171125#M4214</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-03-21T20:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to zoom to selected graphic for the feature datagrid.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171126#M4215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you subscribe to FeatureDataGrid.SelectionChanged event, be sure to use FeatureDataGrid.SelectedGraphics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try the following code with SDK sample &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid&lt;/A&gt;&lt;SPAN&gt;. Notice that the OBJECTID's of current data grid selection are printed on your OutputWindow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private void MyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
 if (MyDataGrid == null || MyDataGrid.SelectedGraphics == null) return;
 System.Diagnostics.Debug.WriteLine("begin selection");
 foreach (var g in MyDataGrid.SelectedGraphics)
&amp;nbsp; System.Diagnostics.Debug.WriteLine(g.Attributes["OBJECTID"]);
 System.Diagnostics.Debug.WriteLine("end selection");
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:52:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171126#M4215</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-11T08:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to zoom to selected graphic for the feature datagrid.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171127#M4216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have just experienced the same behavior as wliang1. In the handler for FeatureDataGrid.SelectionChanged the FeatureDataGrid.SelectedGraphics collection seems not to have been updated yet, so it holds the previous selection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've just upgraded an application to version 2.4 of the Silverlight API, and I'm pretty sure that this behavior has changed since version 2.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A workaround that worked for me was to wrap all code in the handler in Dispatcher.BeginInvoke(), like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private void MyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
 Dispatcher.BeginInvoke(() =&amp;gt;
 {
&amp;nbsp; if (MyDataGrid == null || MyDataGrid.SelectedGraphics == null) return;
&amp;nbsp; System.Diagnostics.Debug.WriteLine("begin selection");
&amp;nbsp; foreach (var g in MyDataGrid.SelectedGraphics)
&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.WriteLine(g.Attributes["OBJECTID"]);
&amp;nbsp; System.Diagnostics.Debug.WriteLine("end selection");
 });
}.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this can be of some help to you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/Markus&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:52:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171127#M4216</guid>
      <dc:creator>MarkusHjärne</dc:creator>
      <dc:date>2021-12-11T08:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to zoom to selected graphic for the feature datagrid.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171128#M4217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This related thread might also be helpful: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/46013-FeatureDataGrid-Selection-Changed-Event"&gt;http://forums.arcgis.com/threads/46013-FeatureDataGrid-Selection-Changed-Event&lt;/A&gt;&lt;SPAN&gt;. You can use e.AddedItems (which contains the selected row) and convert to graphic (see post# 2).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Mar 2012 23:43:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/problem-to-zoom-to-selected-graphic-for-the/m-p/171128#M4217</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2012-03-31T23:43:17Z</dc:date>
    </item>
  </channel>
</rss>

