I'm trying to display polygons, polylines and ellipses on the map using a template selector. The ellipse data template is defined to hotspot to center the ellipse at the MapLayer.Location, but this is getting ignored and the location is still applied to the top-left of the ellipse.
The only way I can get a HotSpot to work on an ellipse is to add the control directly to an information layer and not use a template. Is there any reason the HotSpot shouldn't work in a templated item?
The only way I can get a HotSpot to work on an ellipse is to add the control directly to an information layer and not use a template. Is there any reason the HotSpot shouldn't work in a templated item?
public
class
ViewModel
{
public
List<Location> Locations {
get
{
return
new
List<Location>() {
new
Location(0, 0)}; } }
}
<
Window
x:Class
=
"TelerikMapTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:TelerikMapTest
=
"clr-namespace:TelerikMapTest"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.DataContext
>
<
TelerikMapTest:ViewModel
/>
</
Window.DataContext
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"template"
>
<
telerik:MapEllipse
Width
=
"1000"
Height
=
"1000"
Fill
=
"Blue"
Opacity
=
"0.6"
telerik:MapLayer.Location
=
"{Binding}"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
XUnits
=
"Fraction"
YUnits
=
"Fraction"
/>
</
telerik:MapLayer.HotSpot
>
</
telerik:MapEllipse
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
>
<
telerik:RadMap
>
<
telerik:RadMap.Provider
>
<
telerik:OpenStreetMapProvider
/>
</
telerik:RadMap.Provider
>
<
telerik:InformationLayer
ItemsSource
=
"{Binding Locations}"
ItemTemplate
=
"{StaticResource template}"
/>
<
telerik:InformationLayer
>
<
telerik:MapEllipse
Width
=
"1000"
Height
=
"1000"
Fill
=
"Yellow"
Opacity
=
"0.6"
telerik:MapLayer.Location
=
"0,0"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
XUnits
=
"Fraction"
YUnits
=
"Fraction"
/>
</
telerik:MapLayer.HotSpot
>
</
telerik:MapEllipse
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
</
Grid
>
</
Window
>