如何使用DataTrigger绑定Mouse.Leave命令

时间:2012-10-25 03:57:15

标签: c# wpf

<TextBox Text="" x:Name="txtName"/>
      <Button Content="Click">
          <Button.Style>
              <Style TargetType="Button">
                  <Style.Triggers>
                      <DataTrigger Binding="{Binding ElementName=input, Path=Text}" Value="1">
                          <Setter Property="Mouse.Leave" Value="{Binding OnAdd}"></Setter>
                      </DataTrigger>
                      <DataTrigger Binding="{Binding ElementName=input, Path=Text}" Value="2">
                          <Setter Property="Mouse.Leave" Value="{Binding OnAddMove}"></Setter>
                      </DataTrigger>
                  </Style.Triggers>
              </Style>
          </Button.Style>
      </Button>

Button Click(Property = Command)是由txtName工作的; 但MouseLeave不起作用

0 个答案:

没有答案