I'm trying to follow the example at http://demos.telerik.com/silverlight/#Map/WktReader and I can't get a polygon to load. I'm trying this simple example of hard coding one polygon but will eventually want to load several from SQL. Can someone please take a look at the following code and let me know what I'm doing wrong. There should be one polygon loading around Atlanta. The example in the URL has 4 but I'm only attempting one. I am not using MVVM in this example.
Thanks,
Tim
My xaml looks like:
And my codebehind looks like:
Thanks,
Tim
My xaml looks like:
<
UserControl
x:Class
=
"xxxx.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignWidth
=
"640"
d:DesignHeight
=
"480"
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerik:RadMap
x:Name
=
"radMap"
Center
=
"39.36830, -95.27340"
ZoomLevel
=
"5"
>
<
telerik:InformationLayer
x:Name
=
"informationLayer"
>
<
telerik:InformationLayer.Reader
>
<
telerik:SqlGeospatialDataReader
Source
=
"{Binding Path=WktDataCollection}"
GeospatialPropertyName
=
"Geometry"
ToolTipFormat
=
"Name"
>
<
telerik:SqlGeospatialDataReader.PointTemplate
>
<
DataTemplate
>
<
Border
Background
=
"Yellow"
BorderThickness
=
"1"
Padding
=
"2,2,2,2"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
ElementName
=
"PART_Image"
/>
</
telerik:MapLayer.HotSpot
>
<
Grid
Name
=
"PART_Panel"
>
<
Path
Fill
=
"{Binding Path=PointBrush}"
Name
=
"PART_Image"
>
<
Path.Data
>
<
GeometryGroup
>
<
EllipseGeometry
Center
=
"7,7"
RadiusX
=
"4"
RadiusY
=
"4"
/>
<
EllipseGeometry
Center
=
"7,7"
RadiusX
=
"6"
RadiusY
=
"6"
/>
</
GeometryGroup
>
</
Path.Data
>
</
Path
>
</
Grid
>
</
Border
>
</
DataTemplate
>
</
telerik:SqlGeospatialDataReader.PointTemplate
>
</
telerik:SqlGeospatialDataReader
>
</
telerik:InformationLayer.Reader
>
<
telerik:InformationLayer.ShapeFill
>
<
telerik:MapShapeFill
Fill
=
"#7FFFFFFF"
Stroke
=
"#5A636B"
StrokeThickness
=
"3"
/>
</
telerik:InformationLayer.ShapeFill
>
<
telerik:InformationLayer.HighlightFill
>
<
telerik:MapShapeFill
Fill
=
"#B2FFFFFF"
Stroke
=
"#5A636B"
StrokeThickness
=
"3"
/>
</
telerik:InformationLayer.HighlightFill
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
</
Grid
>
</
UserControl
>
And my codebehind looks like:
using
System;
using
System.Collections.Generic;
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;
using
Telerik.Windows.Controls.Map;
using
System.Collections.ObjectModel;
namespace
xxxx
{
public
partial
class
MainPage : UserControl
{
private
Collection<WktDataRow> _wktDataCollection;
public
Collection<WktDataRow> WktDataCollection
{
get
{
return
this
._wktDataCollection;
}
set
{
this
._wktDataCollection = value;
}
}
public
MainPage()
{
InitializeComponent();
this
.radMap.Provider =
new
BingMapProvider(MapMode.Aerial,
true
,
"myKey"
);
WktDataRow northAreaDataRow =
new
WktDataRow();
northAreaDataRow.Name =
"North Area"
;
northAreaDataRow.Geometry =
"Polygon (("
+
"-84.3932461670301, 33.7967217961125"
+
", -84.418995373573 33.808989109452"
+
", -84.4303250244518 33.8377961143588"
+
", -84.4303250244518 33.8480616114576"
+
", -84.4320416382213 33.8563301427474"
+
", -84.4413113525767 33.8668784860621"
+
", -84.4605374267954 33.8908212383562"
+
", -84.447147839393 33.8996555568394"
+
", -84.4169354370492 33.9161818236152"
+
", -84.384663098182 33.9127628588944"
+
", -84.3788266113656 33.9133326958734"
+
", -84.3633770874397 33.9101985453388"
+
", -84.3616604736702 33.9101985453388"
+
", -84.3300747803108 33.9204553366171"
+
", -84.2957425049201 33.9198855472676"
+
", -84.2596936157599 33.8919612018418"
+
", -84.2713665893927 33.8831260863279"
+
", -84.2768597534552 33.8745751033359"
+
", -84.2905926636114 33.8640277109635"
+
", -84.3039822510137 33.8480616114574"
+
", -84.3125653198613 33.8397922798236"
+
", -84.3489575317754 33.8249625088656"
+
", -84.3589138916386 33.8226807773054"
+
", -84.3688702515018 33.8124122318747"
+
", -84.3822598389041 33.8058511269131"
+
", -84.3932461670301 33.7967217961125"
+
", -84.3932461670301 33.7967217961125"
+
"))"
;
this
.WktDataCollection =
new
Collection<WktDataRow>();
this
.WktDataCollection.Add(northAreaDataRow);
Loaded +=
new
RoutedEventHandler(Map_Loaded);
}
private
void
Map_Loaded(
object
sender, RoutedEventArgs e)
{
}
public
Brush PointBrush
{
get
{
return
new
SolidColorBrush(Color.FromArgb(255, 31, 163, 235));
}
}
}
public
class
WktDataRow
{
private
string
_name;
private
string
_geometry;
public
string
Name
{
get
{
return
this
._name; }
set
{
this
._name = value; }
}
public
string
Geometry
{
get
{
return
this
._geometry; }
set
{
this
._geometry = value; }
}
}
}