xaml では<Storyboard x:Name="WellGraphicStoryboard"></Storyboard>
、UserControl.Resources に含まれています。[コードにもそれを入れたいのですが、リソースを追加する方法がわかりませんでした。]
コードでは、次のようになります。
var duration = new Duration( TimeSpan.FromSeconds( 0.2 ) );
var animation1 = new DoubleAnimation { Duration = duration };
var sb = WellGraphicStoryboard;
sb.Duration = duration;
sb.Children.Clear( );
sb.Children.Add( animation1 );
Storyboard.SetTarget( animation1, _wellGraphic );
Storyboard.SetTargetProperty( animation1, new PropertyPath( "SymbolSize" ) );
animation1.To = 14;
sb.Begin( );
_wellGraphic は、SymbolSize と呼ばれる double プロパティを持つ MyGraphic を継承します。
sb.Begin を押すと、「TargetProperty SymbolSize を解決できません。」というエラーが表示されます。
私も試してみました
Storyboard.SetTarget( animation1, ( MyGraphic )_wellGraphic );
私の目的は、_wellGraphic シンボルを元の値 (7) から 14 に増やすことです。そのため、これを実現する他の方法を受け入れることができます。