MVVM 모델을 사용하고 있습니다.RaisePropertyChanged 이벤트에서 DataTrigger의 스토리 보드가 두 번 이상 트리거되지 않음
종속성 속성 인 "ResultOfUpdate
"이라는 부울 속성이 있습니다. 사용자가 명령을 실행하려고 할 때마다 변경됩니다.
이 종속성 속성에 대한 설정자에서 속성 이름에 "RaisePropertyChanged()
"메서드를 호출하고 있습니다.
는 그것은 그래서 같은 DataTrigger
에 바인딩 :
<DataTrigger Binding="{Binding ResultOfUpdate}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Opacity)"
AutoReverse="True">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.1" Value="0.1"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="0.2"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.3" Value="0.3"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.4" Value="0.4"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.5" Value="0.5"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.6" Value="0.6"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.7" Value="0.7"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.8" Value="0.8"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.9" Value="0.9"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
...
<TextBlock Style="{StaticResource statusStyle}"
Opacity="0" Text="Results updated!"
FontSize="10" FontFamily="Segoe UI"/>
나는이 bool
이 true로 설정 될 때마다 싶습니다은 스토리 보드가 재생됩니다.
이 스토리 보드는 처음에는 사용자가 명령을 처음 실행할 때 올바르게 트리거되고 dependecy 속성은 true로 업데이트됩니다.
후속 시도에서 종속성 속성 설정자 코드가 입력되고 RaisePropertyChanged() 메서드가 호출되지만 스토리 보드는 다시 재생되지 않습니다.
내가 여기서 잘못 했습니까?
업데이트 문제는 생성자의 방법을 떠나는 날의 결과로했다 ! –
반응 값이 변경되도록 값을 false로 다시 설정 했습니까? 그렇지 않으면 계속해서 속성을 'true'로 설정하면 원하는 효과를 얻지 못할 것이라고 생각합니다. – Josh
안타깝게도 false로 설정하면 반응 할 속성을 얻길 원합니다. 이 문제를 해결하기 위해 열거 형을 사용하는 방법에 대해 생각해 보았지만 노력할 가치가 없습니다 (매우 어려워 보인다!). 아마도 null로 설정하거나이 같은 것을 설정할 수 있습니까? –