- antsonthetree
- Posts: 44
- Joined:
UE4 Storyboard Completed Event
Hello,
I'm trying to bind to the Completed event of a storyboard in UE4, but it does not seem to be working. I'm using the ShooterGame demo as a testbed for this. I've added a binding to the Resume function to the OnMainHide storyboard (in GameMenu.xaml) as below:
<Storyboard x:Key="OnMainHide" Completed="{Binding Resume}">
And then removed the binding to Resume from the ResumeButton as below:
<Button x:Name="ResumeButton" Grid.Row="0" Content="RESUME" Style="{StaticResource Style.MenuButton}"/>
The expectation is that the Resume function in the NoesisView would still fire as before, but after the storyboard runs. This would eliminate the need to hard code the delay in the Resume function in the NoesisView. However it does not seem to be getting called at all. I've added a printscreen to the Resume function just for debug purposes and I can confirm that the storyboard is definitely running, but it looks like the completed event never gets called. Any ideas? Is the Storyboard Completed event supported?
Thanks
Jake
I'm trying to bind to the Completed event of a storyboard in UE4, but it does not seem to be working. I'm using the ShooterGame demo as a testbed for this. I've added a binding to the Resume function to the OnMainHide storyboard (in GameMenu.xaml) as below:
<Storyboard x:Key="OnMainHide" Completed="{Binding Resume}">
And then removed the binding to Resume from the ResumeButton as below:
<Button x:Name="ResumeButton" Grid.Row="0" Content="RESUME" Style="{StaticResource Style.MenuButton}"/>
The expectation is that the Resume function in the NoesisView would still fire as before, but after the storyboard runs. This would eliminate the need to hard code the delay in the Resume function in the NoesisView. However it does not seem to be getting called at all. I've added a printscreen to the Resume function just for debug purposes and I can confirm that the storyboard is definitely running, but it looks like the completed event never gets called. Any ideas? Is the Storyboard Completed event supported?
Thanks
Jake
Re: UE4 Storyboard Completed Event
Hi Jake,
Completed is an event, so you can't use Bindings with it. However, we have implemented a couple of Attached Properties in the class EventToCommand that you can use like this:
<Storyboard x:Key="OnMainHide" EventToCommand.Event="Completed" EventToCommand.Command="{Binding Resume}">
I've tested it and it works. I'll update the demo with that change and some missing assets in /Game/UI/Styles as soon as I can.
Completed is an event, so you can't use Bindings with it. However, we have implemented a couple of Attached Properties in the class EventToCommand that you can use like this:
<Storyboard x:Key="OnMainHide" EventToCommand.Event="Completed" EventToCommand.Command="{Binding Resume}">
I've tested it and it works. I'll update the demo with that change and some missing assets in /Game/UI/Styles as soon as I can.
- antsonthetree
- Posts: 44
- Joined:
Re: UE4 Storyboard Completed Event
Excellent! I've just tested this in my test app and it works perfectly.
Thanks a lot for the info!
Jake
Thanks a lot for the info!
Jake
Re: UE4 Storyboard Completed Event
Great! Thanks for the feedback!
Re: UE4 Storyboard Completed Event
How can I define a custom command, in BaseButton, I find it is inherited from ICommandSource, but, I do not know how to define a ICommand for SetCommand, and how to fire it when TouchDownHi Jake,
Completed is an event, so you can't use Bindings with it. However, we have implemented a couple of Attached Properties in the class EventToCommand that you can use like this:
<Storyboard x:Key="OnMainHide" EventToCommand.Event="Completed" EventToCommand.Command="{Binding Resume}">
I've tested it and it works. I'll update the demo with that change and some missing assets in /Game/UI/Styles as soon as I can.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: UE4 Storyboard Completed Event
In Commands sample you can see how it is done in C++.
In that example we created a DelegateCommand class that exposes a function delegate as a command.
And here is how ViewModel uses it.
In that example we created a DelegateCommand class that exposes a function delegate as a command.
And here is how ViewModel uses it.
Re: UE4 Storyboard Completed Event
The sample shows hoe to process Command in ViewModel, but is use an existed Command(Button.Click), and seems no more text explan about how to fire a Command in a UserControl/CustomControlIn Commands sample you can see how it is done in C++.
In that example we created a DelegateCommand class that exposes a function delegate as a command.
And here is how ViewModel uses it.
Re: UE4 Storyboard Completed Event
Hi UE4.
A command is just a property of type ICommand*. You can fire it from anywhere by calling its Execute member function. A Button, for example, has an ICommand property named Command (inherited from the ICommandSource interface) that it calls from its Click event.
A command is just a property of type ICommand*. You can fire it from anywhere by calling its Execute member function. A Button, for example, has an ICommand property named Command (inherited from the ICommandSource interface) that it calls from its Click event.
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 62 guests