モジュールの 1 つで、次のスタイルが設定されているのを見ました。
<Style TargetType="Rectangle">
<Style.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="300" Duration="0:0:1.5"
AccelerationRatio="0.10" DecelerationRatio="0.25"
Storyboard.TargetProperty="(Canvas.Width)" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
でTargetType
あることに注意してください。スタイル/トリガーはまだ正しく機能しています。プロパティをアニメーション化しています。Rectangle
Storyboard.TargetProperty
Canvas.Width
Rectangle.width
Storyboard.TargetProperty (または XAML の他の場所) では、PropertyPath 構文を使用する必要があることを理解しています(ownerType.PropertyName)
。
私の質問は、アニメーションをオンに設定するとどのようにCanvas.Width
アニメーション化されるかですRectangle.Width
- Canvas.Width、Rectangle.Width、または FrameworkElement.Width がすべて FrameowrkElement.Width プロパティを指しているためでしょうか。Width は FrameworkElement で定義されており、Canvas/Rectangle はそこから派生しています。
- それとも、継承により、Canvas と Rectangle の両方が依存関係プロパティの所有者にもなるためでしょうか。