私は可視性をトリガとして使用して(WPFの)ユーザーコントロールをアニメーション化しようとしています。私は何が間違っているのかは分かりませんが、DXは何もしていないようです(私を許してください、私はこれが初めてです)。ストーリーボードの可視性の変更
これは私が私のMainWindow.xamlに持っているものです。
<local:toolbarDiscPlayback x:Name="Main_toolbarDisc" Grid.Row="2" Visibility="Collapsed" Style="{DynamicResource toolbarStyle}"/>
そして背後にある私のコードでは、私は、ユーザーコントロールの可視性を変更するクリックイベントがあります
Main_toolbarDisc.Visibility = Visibility.Visible;
しかし、それは私のリソース辞書にそれを伝えるように私は(希望私)のようにアニメーション化していない:
<Style x:Key="toolbarStyle" TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform Y="0"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
From="150" To="0"
DecelerationRatio="0.5"
Duration="00:00:01.000"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
あなたが気づくように、私はこれまでanimate-inまたはこれまでのところ「目に見えるようになる」ためにこれを行っただけです。私はかなり肯定的です。私はちょうど愚かなことをやっているか、正しい方法でやっていません。
が正確にどのような影響を達成しようとしているのですか? – ChrisF
私は、ユーザーがそれをアクティブにしたときに、このツールバーを画面上にアニメーション表示できることを望んでいます。 ボタンをクリックすると、ツールバーがウィンドウの一番下の画面に移動します(別のボタンをクリックすると、別のツールバーが表示されます)。 –