Select to view content in your preferred language

GraphicLayer.GraphicsSource binding problem

585
0
08-18-2017 12:08 AM
JanPalas
New Contributor

I am using ArcGIS Runtime 10.2.7 and I am trying hard to bind GraphicsLayer.GraphicsSource to my view model. However, whatever I do, GraphicsSource of the GraphicsLayer is always null. 

Is it possible to set binding on this property? Is there some kind of bug with binding on this property you forgot to mention in Docs? Am I doing something wrong or missing something?

If take following code and inspect GraphicsLayer (eg. somewhere in codebehind), you will see that GraphicsSource is null.

My view:

<Window x:Class="EsriWpfApp1.MainWindow"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:local="clr-namespace:EsriWpfApp1"
 xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
 mc:Ignorable="d"
 Title="MainWindow" Height="350" Width="525">
 
 <Window.DataContext>
     <local:MainViewModel/>
 </Window.DataContext>
 <Grid>
     <esri:MapView>
          <esri:Map>
              <esri:GraphicsLayer GraphicsSource="{Binding Shapes}" />
          </esri:Map>
     </esri:MapView>
 </Grid>
</Window>

My ViewModel:

public class MainViewModel
{
     public GraphicCollection Shapes { get; set; } = new GraphicCollection();
}
0 Kudos
0 Replies