I have a ViewModel that provides the string property PageToolBarVisible , which can be true or false :
private string _pageToolBarVisible;
public string PageToolBarVisible
{
get
{
return _pageToolBarVisible;
}
set
{
_pageToolBarVisible = value;
OnPropertyChanged("PageToolBarVisible");
}
}
Then, in my View , I have this DataTrigger , which displays or hides the toolbar, respectively:
<Style x:Key="PageToolBarStyle" TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding PageToolBarVisible}" Value="false">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Border Style="{StaticResource PageToolBarStyle}"
DockPanel.Dock="Bottom" Padding="5 5 5 0" Background="#eee">
<Grid Background="#eee">
...
</Grid>
</Border>
How can I add animation now to:
- when the ViewModel property is changed from true to false , the toolbar disappears
- ViewModel false true,
, - , , :
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="PageToolBar"
Storyboard.TargetProperty="(TextBlock.Opacity)"
From="0.0" To="1.0" Duration="0:0:3"/>
</Storyboard>
</BeginStoryboard>