Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to bind to enum inside of DataTrigger, why isn't it working?

I would expect my Ellipse to be Red right now.

enter image description here

<UserControl x:Class="BenchmarkPlus.PMT.UI.Views.NotificationIndicator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Models="clr-namespace:BenchmarkPlus.PMT.UI.Models"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300"
             x:Name="root"
             DataContext="{x:Static Models:NotificationType.Error}">
  <Grid>
    <Ellipse>
      <Ellipse.Style>
        <Style TargetType="Ellipse">
          <Setter Property="Fill"
                  Value="Blue" />
          <Style.Triggers>
            <DataTrigger Binding="{Binding}"
                         Value="{x:Static Models:NotificationType.Info}">
              <Setter Property="Fill"
                      Value="Green" />
            </DataTrigger>
            <DataTrigger Binding="{Binding}"
                         Value="{x:Static Models:NotificationType.Error}">
              <Setter Property="Fill"
                      Value="Red" />
            </DataTrigger>
          </Style.Triggers>
        </Style>
      </Ellipse.Style>
    </Ellipse>
  </Grid>
</UserControl>
like image 202
Jon Erickson Avatar asked Apr 20 '12 17:04

Jon Erickson


1 Answers

This doesn't appear to work in VS2010 designer, but does in VS11. Yet another reason to switch to VS11 beta :)

like image 134
Phil Avatar answered Nov 19 '22 14:11

Phil