wpf에서 경로 데이터를 어떻게 움직이게할까요? 이 속성을 변경하는 일련의 templated silverlight-5 컨트롤이 있습니다. 이러한 컨트롤은 wpf에서 작동하도록 조정해야합니다. wpf에서 VSM이 상태를 변경하려고하면 다음 예외가 발생하여 충돌합니다.wpf 스토리 보드의 Path.Data 변경
'System.Windows.Media'를 사용하여 'System.Windows.Shapes.Path'에서 'Data'속성에 애니메이션을 적용 할 수 없습니다. Animation.ObjectAnimationUsingKeyFrames '
내부 예외 : 'Data '속성에 적용된 애니메이션은 속성의 유효한 값이 아닌 [XXX-The path data-]의 현재 값을 계산합니다.
아래의 예는 버튼 컨트롤입니다. 원에서 별까지가는 경로 - 어떻게 wpf에서 구현 될 수 있습니까?
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Path.Data)" Storyboard.TargetName="path">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>M 291.42858 512.36218 216.73569 387.62221 74.321018 416.8994 169.87441 307.31546 98.0216 180.91821 l 133.74814 57.01338 98.00719 -107.39498 -12.89251 144.82014 132.42459 60.0235 -141.71614 32.49039 z</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox>
<Path x:Name="path" Stroke="Black" Fill="Black" UseLayoutRounding="False" Data="m 357.14285 425.21933 c 0 71.79702 -58.20298 130 -130 130 -71.79701 0 -129.999997 -58.20298 -129.999997 -130 0 -71.79702 58.202987 -130 129.999997 -130 71.79702 0 130 58.20298 130 130 z"/>
</Viewbox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
범례! 고마워요. :) – user495625
도와 줘서 고맙군요. :) –