My MVVM app loads user defined polygons from a DB and then databinds the information layer (after the map is initialised, as suggested in the documentation).
When I explicitly declare the colours in the data template the binding works perfectly. But when I data bind the colours (using a converter to convert them to a SolidColorBrush) it doesn't display the shapes at all.
Here's the XAML...
<telerik:RadMap x:Name="mapControl" Center="53.54245,-2.298817" ZoomLevel="7"> <telerik:InformationLayer x:Name="shapeLayer" Visibility="Visible"> <telerik:InformationLayer.ItemTemplate> <DataTemplate> <telerik:MapPolyline Fill="{Binding Fill, Converter={StaticResource converter}}" Opacity="0.5" Points="{Binding Points}" Stroke="{Binding Stroke, Converter={StaticResource converter}}" StrokeThickness="2" /> </DataTemplate> </telerik:InformationLayer.ItemTemplate> </telerik:InformationLayer></telerik:RadMap>
Here's the view model that I'm using for each shape.
public class ShapeViewModel : ViewModelBase
{
private LocationCollection _points;
private Color _stroke;
private Color _fill;
public LocationCollection Points
{
get { return _points; }
set
{
if (_points != value)
{
_points = value;
OnPropertyChanged(() => Points);
}
}
}
public Color Fill
{
get { return _fill; }
set
{
if (_fill != value)
{
_fill = value;
OnPropertyChanged(() => Fill);
}
}
}
public Color Stroke
{
get { return _stroke; }
set
{
if (_stroke != value)
{
_stroke = value;
OnPropertyChanged(() => Stroke);
}
}
}
}
I don't see any binding errors in my output window.
Thanks
Ben