PropertyChangedTriggers all firing on game load
Posted: 04 Aug 2023, 19:09
I have a DataTemplate containing multiple storyboards all hooked up to PropertyChangedTriggers. But when I load the game it seems like the all of these triggers are being trigger by the instantiation of the associated variable.
Other than this, the PropertyChangedTriggers all work as expected. Am I setting these Triggers up incorrectly?
Below is an example of the code I'm using. I am seeing both of the storyboard playing as soon as an example of the DataTemplate is created in game
Xaml Implementation of Storyboard and triggers within DataTemplate
Unreal C++ MyDataTemplate.h declaration of Property variables
Unreal C++ MyDataTemplate.cpp (the only place the variables are referenced). Even if these functions are not called, the Storyboards still play
Unreal C++ MyDataTemplate.cpp (creating the DataTemplate object and adding it to a list)
Other than this, the PropertyChangedTriggers all work as expected. Am I setting these Triggers up incorrectly?
Below is an example of the code I'm using. I am seeing both of the storyboard playing as soon as an example of the DataTemplate is created in game
Xaml Implementation of Storyboard and triggers within DataTemplate
Code: Select all
<Grid.Resources>
<Storyboard x:Key="DataTemplate_Timeline_IN">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="Element1_Scale">
<EasingDoubleKeyFrame KeyTime="0" Value="0.8"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="Element1_Scale">
<EasingDoubleKeyFrame KeyTime="0" Value="0.8"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Element1">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.8"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="DataTemplate_Timeline_Highlight">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Element2">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<b:Interaction.Triggers>
<b:PropertyChangedTrigger Binding="{Binding DataTimelineInAnim}">
<b:ControlStoryboardAction ControlStoryboardOption="Play" Storyboard="{StaticResource DataTemplate_Timeline_IN}"/>
</b:PropertyChangedTrigger>
<b:PropertyChangedTrigger Binding="{Binding DataTimelineHighlightAnim}">
<b:ControlStoryboardAction ControlStoryboardOption="Play" Storyboard="{StaticResource DataTemplate_Timeline_Highlight}"/>
</b:PropertyChangedTrigger>
</b:Interaction.Triggers>
Code: Select all
UPROPERTY()
bool DataTimelineInAnim = false;
UPROPERTY()
bool DataTimelineHighlightAnim = false;
Unreal C++ MyDataTemplate.cpp (the only place the variables are referenced). Even if these functions are not called, the Storyboards still play
Code: Select all
void UAwarenessIndicatorData::Play_DataTimelineInAnim ()
{
DataTimelineInAnim = !DataTimelineInAnim ;
NoesisNotifyPropertyChanged(this, "DataTimelineInAnim ");
}
Code: Select all
MyDataTemplate = CreateDataModel<UMyDataTemplate>("");
ViewModel->MyList.Add(MyDataTemplate );
NoesisNotifyArrayPropertyPostAdd(&ViewModel->MyList);