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
425
Marker DataTemplate Trigger
posted

Hi (Graham? ;),

I'm trying to get this working.

        <DataTemplate x:Key="CircleMarkerTemplate">
            <Ellipse x:Name="myEllipse"
                     Effect="{StaticResource MarkerEffect}"
                     Stretch="Fill"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     Fill="Red"
                     Stroke="Black"
                     StrokeThickness="1"
                     MinWidth="7"
                     MinHeight="7" />
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MonthlyCharges}}, Path=Item.IsSelected}" Value="True">
                    <Setter Property="Fill" TargetName="myEllipse" Value="Cyan" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>

I have added an IsSelected property to my MonthlyCharge object and I'm trying to change the color of the marker based on this bool property, not working at the moment as the FindAncestor is only finding a ContentControl ... I've used FindAncestor like this loads of times but in this scenario it's completely failing.  Any ideas?

Parents Reply Children
No Data