- ThisIsMyUserName
- Posts: 6
- Joined:
PropertyChangedTriggers all firing on game load
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);
-
sfernandez
Site Admin
- Posts: 3109
- Joined:
Re: PropertyChangedTriggers all firing on game load
I'll have to verify the behavior in WPF but I think it is expected as it triggers when the binding is evaluated for the first time.
In the meantime you can try to disable the actions until the control is loaded for example:
In the meantime you can try to disable the actions until the control is loaded for example:
Code: Select all
<b:Interaction.Triggers>
<b:PropertyChangedTrigger Binding="{Binding DataTimelineInAnim}">
<b:ControlStoryboardAction x:Name="PlayInAction" IsEnabled="False"
ControlStoryboardOption="Play" Storyboard="{StaticResource DataTemplate_Timeline_IN}"/>
</b:PropertyChangedTrigger>
<b:PropertyChangedTrigger Binding="{Binding DataTimelineHighlightAnim}">
<b:ControlStoryboardAction x:Name="HighlightAction" IsEnabled="False"
ControlStoryboardOption="Play" Storyboard="{StaticResource DataTemplate_Timeline_Highlight}"/>
</b:PropertyChangedTrigger>
<b:EventTrigger EventName="Loaded">
<b:ChangePropertyAction TargetName="PlayInAction" PropertyName="IsEnabled" Value="True"/>
<b:ChangePropertyAction TargetName="HightlightAction" PropertyName="IsEnabled" Value="True"/>
</b:EventTrigger>
</b:Interaction.Triggers>
- ThisIsMyUserName
- Posts: 6
- Joined:
Re: PropertyChangedTriggers all firing on game load
That has done the trick for now, thank you. I was previously calling the In Storyboard on the same frame I created the object, but a single frame delay isn't much of an issue for now
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests