I'm trying to bind graphics to an Odata Service. The listbox and details grid work, but I can't get the graphics to show on the map<UserControl
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:esri="http://schemas.esri.com/arcgis/client/2009" x:Class="SilverlightClient.MainPage"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<esri:SimpleMarkerSymbol x:Key="SelectMarkerSymbol" Size="12" Color="Red" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ListBox ItemsSource="{Binding}" DisplayMemberPath="ID" x:Name="PointsList" Margin="8" />
<StackPanel DataContext="{Binding SelectedItem, ElementName=PointsList}" Margin="8" Grid.Row="1">
<TextBlock Text="Details:"/>
<TextBlock Text="{Binding ID}"/>
<TextBlock Text="{Binding Lat}"/>
<TextBlock Text="{Binding Lon}"/>
<TextBlock Text="{Binding Desc}"/>
</StackPanel>
<esri:Map Background="White" Grid.Row="2" WrapAround="True">
<esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer>
<esri:GraphicsLayer.GraphicsSource>
<esri:PointDataSource
ItemsSource="{Binding}"
XCoordinateBinding="{Binding Lat}"
YCoordinateBinding="{Binding Lon}">
</esri:PointDataSource>
</esri:GraphicsLayer.GraphicsSource>
<esri:GraphicsLayer.Renderer>
<esri:SimpleRenderer Symbol="{StaticResource SelectMarkerSymbol}" />
</esri:GraphicsLayer.Renderer>
</esri:GraphicsLayer>
</esri:Map>
</Grid>
</UserControl>
using SilverlightClient.ServiceReference;
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SilverlightClient
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
var ctx = new SpatialEntities(new Uri("/DemoNonSpatial.svc", UriKind.Relative));
var qry = from g in ctx.SpatialDemoTable
select g;
var coll = new DataServiceCollection<SpatialDemoTable>();
coll.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(coll_LoadCompleted);
coll.LoadAsync(qry);
DataContext = coll;
}
void coll_LoadCompleted(object sender, LoadCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Error Detected, handle accordingly.");
}
}
}
}
Am I missing something??