AnsweredAssumed Answered

Support a ListCollectionView for a GraphicsLayer GraphicSource (WPF/.NET)

Question asked by epaitz-esristaff Employee on Nov 12, 2014
Latest reply on Nov 14, 2014 by epaitz-esristaff

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.


Something like the following.


Graphics = new ObservableCollection<Graphic>();
GraphicsView = new ListCollectionView(Graphics);
GraphicsView.Filter = new Predicate<object>(GraphicsViewFilter);


private bool GraphicsViewFilter(object item){
   return true;  //Custom filter logic goes her
Binding binding = new Binding("GraphicsView") { Source = ViewModel };
BindingOperations.SetBinding(graphicsLayer, GraphicsLayer.GraphicsSourceProperty, binding);

This would allow many GraphicsLayers to be created against a single source Collection but display different results.


See more at: