<UserControl x:Class="SilverlightSqlSpatial.Map.MainPage"
    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:demo="clr-namespace:SilverlightSqlSpatial.Map.ViewModels"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="480" d:DesignWidth="640">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <!--Add the extended data converter-->
            <telerik:ExtendedDataConverter x:Key="ExtendedDataConverter" />
            
            <!--Create a template for the county tooltips-->
            <DataTemplate x:Key="CountyToolTipDataTemplate">
                <StackPanel Margin="10,5">
                    <TextBlock FontWeight="Bold" Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Name'}" />
                    <TextBlock Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='StateName'}" />
                </StackPanel>
            </DataTemplate>
        </Grid.Resources>

<!--Add the rad map-->
<telerik:RadMap x:Name="RadMap1"
                Center="38.0, -98.371616833534"
                ZoomLevel="4">
    <!--Set the map provider-->
    <telerik:RadMap.Providers>
        <telerik:OpenStreetMapProvider />
    </telerik:RadMap.Providers>
    <!--Create an information layer to display our shapes-->
    <telerik:InformationLayer x:Name="InformationLayer">
        <!--Tell the information layer where to read its data from-->
        <telerik:InformationLayer.Reader>
            <!--Tell the information layer to read the shape information from our view model's "SpeatialData" Property, 
            and tell it which property contains our WKT, we also set the tool tip template-->
            <telerik:SqlGeospatialDataReader Source="{Binding SpatialData}"
                                                GeospatialPropertyName="GeographyWKT"
                                                ToolTipTemplate="{StaticResource CountyToolTipDataTemplate}"/>
        </telerik:InformationLayer.Reader>
        <!--Set map shape styles-->
        <telerik:InformationLayer.ShapeFill>
            <telerik:MapShapeFill Fill="#AFFFF7DE" Stroke="#5A636B" StrokeThickness="3" />
        </telerik:InformationLayer.ShapeFill>
        <telerik:InformationLayer.HighlightFill>
            <telerik:MapShapeFill Fill="#DFF7E7BD" Stroke="#5A636B" StrokeThickness="3" />
        </telerik:InformationLayer.HighlightFill>
    </telerik:InformationLayer>

</telerik:RadMap>

    </Grid>

</UserControl>
