UE4
Topic Author
Posts: 62
Joined: 29 Dec 2017, 06:32

Re: How to send event from view to VM?

12 Mar 2018, 04:42

the Command can be set only once?
 
User avatar
hcpizzi
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: How to send event from view to VM?

12 Mar 2018, 23:08

Do you mean if you can have more than one Command bound to a given event?
 
UE4
Topic Author
Posts: 62
Joined: 29 Dec 2017, 06:32

Re: How to send event from view to VM?

13 Mar 2018, 02:01

My game logic will process TouchDown/TouchUp event, so I think there should be both two commands for MVVM, am I wrong?
At present, then EventToCommand can be used only once, so I implement a UserControl, and treat both TouchDown and TouchUp as ButtonAction event, but pass deffirent param, then convert to command and I can use one command send 2 actions.
 
User avatar
hcpizzi
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: How to send event from view to VM?

15 Mar 2018, 15:00

Hi,

Yes, you are right, that is a limitation of the EventToCommand class. We are working on an new system that will allow you to bind multiple events to commands, with a syntax like this:
<ListBox ...>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="SelectionChanged">
            <i:InvokeCommandAction Command="{Binding SelectedItemChangedCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</ListBox>

Who is online

Users browsing this forum: No registered users and 1 guest