내 페이지를 깜박 거리게 만드는 데이터 트리거를 만들고 싶습니다 (투명에서 빨간색으로). 그래서 나는 내 viewmodel 내에서 부울 플래그를 수신하는 DataTrigger를 만들었습니다. 이 플래그는 사용자가 상기시켜야 할 때마다 나타냅니다. 이 경우 내 페이지가 투명에서 빨간색으로 깜박입니다.DataTrigger가 실행되지 않는 것 같습니다.
데이터 트리거를 올바른 방식으로 구현 했음에도 불구하고 내 앱은 아무 것도하지 않습니다. 오류가없고 깜박이지 않습니다. 그래서 놓친 게있을 것입니다.
<Style x:Key="ReminderPage" TargetType="{x:Type ViewTemplates:TpApplicationBarView}" BasedOn="{StaticResource TpApplicationBarViewStyle}">
<Style.Triggers>
<!-- Reminder animation, when the time comes to remind the user -->
<DataTrigger Binding="{Binding IndicateReminderAnimation}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard x:Name="Blink">
<ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)"
AutoReverse="True"
From="Transparent"
To="Red"
Duration="0:0:1"
RepeatBehavior="Forever">
</ColorAnimation >
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding IndicateReminderAnimation}" Value="False">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)"
AutoReverse="False"
To="Transparent"
Duration="0:0:1">
</ColorAnimation >
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
그래서 내가 잘못 했습니까?
업데이트 :
System.Windows.Media.Animation Warning: 6 : Unable to perform action because
the specified Storyboard was never applied to this object for interactive control.;
Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard';
Storyboard.HashCode='61356140'; Storyboard.Type='System.Windows.Media.Animation.Storyboard';
TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='61356140';
TargetElement.Type='System.Windows.Media.Animation.Storyboard'
갱신 2 : 내가 출력 창에 다음과 같은 메시지가 볼 수 arround를 인터넷 검색 후를 나는 그것이 UI 스레드에 문제가 있음을, 발견했다. 그래서 나는 바인딩 된 속성을 설정할 때마다 디스패처 호출을 만들었습니다. 그러나이 트릭을 사용하더라도 색상 애니메이션이 없습니다. 그러나 출력 창의 오류가 사라진 것 같습니다. 그래서 애니메이션을 수정하는 방법에 대한 더 많은 아이디어를 찾고 있습니다.
업데이트 3 : 페이지의 배경색을 설정하는 것이 일반적인 문제인 것처럼 보입니다. 그러나 그것은 정말로 이상합니다. Page는 NavigationFrame에 배치됩니다. 탐색 프레임의 배경색을 설정하면 응용 프로그램의 색상이 변경되지만 아무런 애니메이션이 없어도 페이지의 배경색을 설정해도 아무 것도 바뀌지 않습니다.
'IndicateReminderAnimation' 속성에 대해'INotifyPropertyChanged'를 구현 했습니까? 런타임 중에 VS에서 출력 창을 확인 했습니까? 바인딩 오류가 있습니까? – nemesv
hm. INotifyPropertyChanged를 구현했습니다. 그러나 출력을보고 다음 오류가 발생했습니다. System.Windows.Media.Animation 경고 : 6 : 지정된 스토리 보드가 대화 형 제어를 위해이 개체에 적용되지 않았기 때문에 작업을 수행 할 수 없습니다. 액션 = '멈춤'; Storyboard = 'System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode = '61356140'; Storyboard.Type = 'System.Windows.Media.Animation.Storyboard'; TargetElement = 'System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode = '61356140'; TargetElement.Type = 'System.Windows.Media.Animation.Storyboard ' – BitKFu