Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1531
Using DataTrigger for seeting GeographicSymbolSeries MarkerTemplate
posted

Hello,

I'm using the XamGeographicMap control and plotting a GeographicSymbolSeries.  I want to use a data trigger to customize the marker based on one of the properties of the series ItemsSource.

I'm trying something like this in my XAML:

<LinearGradientBrush x:Key="StandardBackground" EndPoint="0.5,1" StartPoint="0.5,0">

    <GradientStop Color="#FF8CCDEC" />

    <GradientStop Color="#FF38A3D6" Offset="1" />

</LinearGradientBrush>

 <LinearGradientBrush x:Key="PoolBackground" EndPoint="0.5,1" StartPoint="0.5,0">

    <GradientStop Color="#FFEAEC8C" />

    <GradientStop Color="#FFD4D638" Offset="1" />

</LinearGradientBrush>

 <SolidColorBrush x:Key="StandardStroke" Color="Black" />

 <Ellipse x:Key="StandardEllipse"

         Width="10"

         Height="10"

         Fill="{StaticResource StandardBackground}"

         Stroke="{StaticResource StandardStroke}"

         StrokeThickness="0.5" />

 <Ellipse x:Key="PoolEllipse"

         Width="10"

         Height="10"

         Fill="{StaticResource PoolBackground}"

         Stroke="{StaticResource StandardStroke}"

         StrokeThickness="0.5" />

 <DataTemplate x:Key="MarkerTemplate">

    <ContentControl Content="{Binding}"/>

    <DataTemplate.Triggers>

        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=MeterType}" Value="Standard">

            <Setter Property="Content" Value="{StaticResource StandardEllipse}" />

        </DataTrigger>

        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=MeterType}" Value="Pool">

            <Setter Property="Content" Value="{StaticResource PoolEllipse}" />

        </DataTrigger>

    </DataTemplate.Triggers>

</DataTemplate>


 

Then when I create the series, I set it's MarkerTemplate to "MarkerTemplate".  This obviously doesn't work.  Are there any examples of using DataTriggers for controlling the MarkerTemplate of a GeographicSymbolSeries?

Thanks, Steve