我正在尝试根据属性的值使网格“淡入”或“淡出”。该属性被调用,但动画似乎没有影响网格。我的网格和触发器如下所示:
<Grid Background="White"
Opacity="0">
<Grid.Style>
<Style TargetType="Grid">
<Style.Triggers>
<DataTrigger Binding="{Binding IsWaiting}"
Value="False">
<DataTrigger.EnterActions>
<BeginStoryboard Name="pickIn">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.8" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<StopStoryboard BeginStoryboardName="pickIn" />
</DataTrigger.ExitActions>
</DataTrigger>
<DataTrigger Binding="{Binding IsWaiting}"
Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Name="pickOut">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
From="1"
To="0"
Duration="0:0:0.8" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<StopStoryboard BeginStoryboardName="pickOut" />
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Grid.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.8" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
<!-- etc -->
</Grid>
我的IsWaiting
财产看起来像:
public bool IsWaiting{
get { return _isWaiting; }
set {
_isWaiting = value;
OnPropertyChanged("IsWaiting");
}
}
属性更改时,输出日志中没有绑定错误。我究竟做错了什么?