<?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: Support a ListCollectionView for a GraphicsLayer GraphicSource (WPF/.NET) in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492641#M2464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GraphicsSource can be any enumerable of Graphics so you can create your own class that implements IEnumerable&amp;lt;Graphic&amp;gt; and subclasses CollectionView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;public class GraphicsCollectionView : ListCollectionView, IEnumerable&amp;lt;Graphic&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; public GraphicsCollectionView(ObservableCollection&amp;lt;Graphic&amp;gt; graphics) : base(graphics)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; public new IEnumerator&amp;lt;Graphic&amp;gt; GetEnumerator()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return this.OfType&amp;lt;Graphic&amp;gt;().GetEnumerator();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use it as you proposed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Graphics = new ObservableCollection&amp;lt;Graphic&amp;gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;var graphicsView = new GraphicsCollectionView(Graphics);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;graphicsView.Filter = new Predicate&amp;lt;object&amp;gt;(GraphicsViewFilter);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;graphicsLayer.GraphicsSource = graphicsView;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;private bool GraphicsViewFilter(object item){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; return true;&amp;nbsp; //Custom filter logic goes her&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Nov 2014 11:07:17 GMT</pubDate>
    <dc:creator>DominiqueBroux</dc:creator>
    <dc:date>2014-11-13T11:07:17Z</dc:date>
    <item>
      <title>Support a ListCollectionView for a GraphicsLayer GraphicSource (WPF/.NET)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492640#M2463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The WPF ListBox supports filtering by using a ListCollectionView or an ICollectionView and defining the Filter Predicate of the View. This allows several views to be created against the same source collection. The same functionality needs to be supported with the GraphicsLayer and its GraphicSource.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Graphics = new ObservableCollection&amp;lt;Graphic&amp;gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;GraphicsView = new ListCollectionView(Graphics);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;GraphicsView.Filter = new Predicate&amp;lt;object&amp;gt;(GraphicsViewFilter);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;private bool GraphicsViewFilter(object item){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; return true;&amp;nbsp; //Custom filter logic goes her&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Binding binding = new Binding("&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;GraphicsView&lt;/STRONG&gt;&lt;/SPAN&gt;") { Source = ViewModel };&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;BindingOperations.SetBinding(graphicsLayer, GraphicsLayer.GraphicsSourceProperty, binding);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This would allow many GraphicsLayers to be created against a single source Collection but display different results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See more at: &lt;A href="http://ideas.arcgis.com/ideaView?id=087E00000005HKC&amp;amp;returnUrl=%2Fapex%2FideaList%3Fc%3D09a300000004xET%26category%3D%26sort%3Drecent"&gt;http://ideas.arcgis.com/ideaView?id=087E00000005HKC&amp;amp;returnUrl=%2Fapex%2FideaList%3Fc%3D09a300000004xET%26category%3D%26sort%3Drecent&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 15:58:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492640#M2463</guid>
      <dc:creator>EricPaitz</dc:creator>
      <dc:date>2014-11-12T15:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Support a ListCollectionView for a GraphicsLayer GraphicSource (WPF/.NET)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492641#M2464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GraphicsSource can be any enumerable of Graphics so you can create your own class that implements IEnumerable&amp;lt;Graphic&amp;gt; and subclasses CollectionView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;public class GraphicsCollectionView : ListCollectionView, IEnumerable&amp;lt;Graphic&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; public GraphicsCollectionView(ObservableCollection&amp;lt;Graphic&amp;gt; graphics) : base(graphics)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; public new IEnumerator&amp;lt;Graphic&amp;gt; GetEnumerator()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return this.OfType&amp;lt;Graphic&amp;gt;().GetEnumerator();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use it as you proposed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Graphics = new ObservableCollection&amp;lt;Graphic&amp;gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;var graphicsView = new GraphicsCollectionView(Graphics);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;graphicsView.Filter = new Predicate&amp;lt;object&amp;gt;(GraphicsViewFilter);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;graphicsLayer.GraphicsSource = graphicsView;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;private bool GraphicsViewFilter(object item){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; return true;&amp;nbsp; //Custom filter logic goes her&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 11:07:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492641#M2464</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2014-11-13T11:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Support a ListCollectionView for a GraphicsLayer GraphicSource (WPF/.NET)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492642#M2465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Dominique, thank you very much for this explination. I was able to get this to work in a test project. Very cool! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 22:07:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/support-a-listcollectionview-for-a-graphicslayer/m-p/492642#M2465</guid>
      <dc:creator>EricPaitz</dc:creator>
      <dc:date>2014-11-14T22:07:35Z</dc:date>
    </item>
  </channel>
</rss>

