<?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 Being notified when a selection was just made in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327131#M1641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've a property grid that I want to show the common attributes for the selected elements in the map. I've seen two different ways to do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Attaching a method to the OnEditCompleted() event in the ESRI.ArcGIS.Client.Editor class. So I can check that the user just finish selecting the elements and I can take the SelectedGraphics collection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Using the SelectedGraphics property in the GraphicsLayer class. In fact, I can't use directly. You have exposed the property as a IEnumerable&amp;lt;Graphic&amp;gt; altough the private field that is returned is an ObservableCollection&amp;lt;Graphic&amp;gt; (why not exposing it directly as a observable collection?). So I cast this property to it's original value and attach a method to the CollectionChanged event. This allows me to know when an element has been selected (or deselected).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, but each method has its share of problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1) That works ok. But what if I can select from other places, like from a tree view with all elements? This tree view, for example, has nothing to do with the Editor (directly). I'll change the Selected property for the element (graphic) but this event wont be fired (expected).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2) If I select 100 elements, the CollectionChanged event will be fired 100 times. No matter what I do, it becames slow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, what I need is a generic way (event?) to know when the user has just finish selecting elements. Be it 100 elements or just one, I would attach a method to an event and be notified just one time. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something? Do we have some way to do it today?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;André&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2011 13:06:47 GMT</pubDate>
    <dc:creator>AndreMachado</dc:creator>
    <dc:date>2011-11-08T13:06:47Z</dc:date>
    <item>
      <title>Being notified when a selection was just made</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327131#M1641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've a property grid that I want to show the common attributes for the selected elements in the map. I've seen two different ways to do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Attaching a method to the OnEditCompleted() event in the ESRI.ArcGIS.Client.Editor class. So I can check that the user just finish selecting the elements and I can take the SelectedGraphics collection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Using the SelectedGraphics property in the GraphicsLayer class. In fact, I can't use directly. You have exposed the property as a IEnumerable&amp;lt;Graphic&amp;gt; altough the private field that is returned is an ObservableCollection&amp;lt;Graphic&amp;gt; (why not exposing it directly as a observable collection?). So I cast this property to it's original value and attach a method to the CollectionChanged event. This allows me to know when an element has been selected (or deselected).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, but each method has its share of problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1) That works ok. But what if I can select from other places, like from a tree view with all elements? This tree view, for example, has nothing to do with the Editor (directly). I'll change the Selected property for the element (graphic) but this event wont be fired (expected).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2) If I select 100 elements, the CollectionChanged event will be fired 100 times. No matter what I do, it becames slow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, what I need is a generic way (event?) to know when the user has just finish selecting elements. Be it 100 elements or just one, I would attach a method to an event and be notified just one time. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something? Do we have some way to do it today?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;André&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 13:06:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327131#M1641</guid>
      <dc:creator>AndreMachado</dc:creator>
      <dc:date>2011-11-08T13:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Being notified when a selection was just made</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327132#M1642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can subscribe to GraphicsLayer.PropertyChanged event and check for e.PropertyName = "SelectionCount" or "SelectedGraphics". Both of these properties will raise PropertyChanged event when graphics are added to or removed from SelectedGraphics. You can check for graphic.Selected property.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 18:01:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327132#M1642</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-11-11T18:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Being notified when a selection was just made</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327133#M1643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can subscribe to GraphicsLayer.PropertyChanged event and check for e.PropertyName = "SelectionCount" or "SelectedGraphics". Both of these properties will raise PropertyChanged event when graphics are added to or removed from SelectedGraphics. You can check for graphic.Selected property.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Jennifer. But the problem is: if I support multiple selection and the user selects 100 elements, this event will be fired 100 times, right? That will be not good from a performance perspective because I'll need to also treat this event 100 times...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andre&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 18:10:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327133#M1643</guid>
      <dc:creator>AndreMachado</dc:creator>
      <dc:date>2011-11-11T18:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Being notified when a selection was just made</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327134#M1644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think the best approach then would be #1 in your first post: Use Editor.EditCompleted event. And should selection come from TreeView, you could add your own event that returns you selected graphics.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 13:34:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/being-notified-when-a-selection-was-just-made/m-p/327134#M1644</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-11-15T13:34:11Z</dc:date>
    </item>
  </channel>
</rss>

