antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

UE4 Storyboard Completed Event

22 Jan 2018, 19:44

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
 
User avatar
hcpizzi
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: UE4 Storyboard Completed Event

23 Jan 2018, 21:20

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.
 
antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

Re: UE4 Storyboard Completed Event

24 Jan 2018, 03:24

Excellent! I've just tested this in my test app and it works perfectly.

Thanks a lot for the info!

Jake
 
User avatar
jsantos
Site Admin
Posts: 2908
Joined: 20 Jan 2012, 17:18
Contact:

Re: UE4 Storyboard Completed Event

24 Jan 2018, 04:03

Great! Thanks for the feedback!
 
UE4
Posts: 62
Joined: 29 Dec 2017, 06:32

Re: UE4 Storyboard Completed Event

05 Mar 2018, 05:33

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.
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 TouchDown
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: UE4 Storyboard Completed Event

06 Mar 2018, 18:02

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.
 
UE4
Posts: 62
Joined: 29 Dec 2017, 06:32

Re: UE4 Storyboard Completed Event

07 Mar 2018, 09:59

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.
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/CustomControl
 
User avatar
hcpizzi
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: UE4 Storyboard Completed Event

16 Mar 2018, 22:54

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.

Who is online

Users browsing this forum: No registered users and 1 guest