Wpf 试图绑定到DataTrigger内部的枚举,为什么不';它不起作用吗?

Wpf 试图绑定到DataTrigger内部的枚举,为什么不';它不起作用吗?,wpf,xaml,data-binding,Wpf,Xaml,Data Binding,我希望我的椭圆现在是红色的 <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" x

我希望我的椭圆现在是红色的

<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>



这在VS2010 designer中似乎不起作用,但在VS11中起作用。切换到VS11 beta的另一个原因是:)

在运行时也是如此?我什么都不相信GUI设计师。天哪,你说得对。。。愚蠢的设计者我使用了枚举类来获取值,并将其绑定到图像源。绑定到属性事件和usign枚举数的混合。没有这个例子,第二部分是不可能的。谢谢