User avatar
ttermeer-reboundcg
Topic Author
Posts: 13
Joined: 13 Sep 2019, 11:10
Contact:

Interaction Triggers no longer working in 3.1.x

29 Oct 2021, 15:26

In the process of updating NoesisGUI from 3.0.x, we noticed some interaction are no longer working.

The following code no longer work in 3.1.0 and 3.1.1 (with Unity 2020.3)
There is no visible error in logs. The behavior works under WPF and previous version of Noesis.
        <ListView  ItemsSource="{Binding Players}" x:Name="PlayersRankingView" Margin="20,10,20,10">
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="130">
                        <GridViewColumnHeader Content="Test"/>
                    </GridViewColumn>
                </GridView>
            </ListView.View>

            <b:Interaction.Triggers>
                <b:EventTrigger EventName="MouseLeftButtonUp">
                    <b:InvokeCommandAction Command="{Binding PlayerClickCommand}" CommandParameter="{Binding ElementName=PlayersRankingView, Path=SelectedItem}"/>
                </b:EventTrigger>
            </b:Interaction.Triggers>

        </ListView>

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2415
Joined: 22 Dec 2011, 19:20

Re: Interaction Triggers no longer working in 3.1.x

01 Nov 2021, 12:52

In 3.1 version some controls react to the mouse up event instead of mouse down to work better along with touch and manipulations. The ListBoxItem now does the selection during mouse up and handles the event, so it won't reach the parent control and its triggers. You can just listen to PreviewMouseUp/PreviewMouseLeftButtonUp instead.

Could that work for you?
 
User avatar
ttermeer-reboundcg
Topic Author
Posts: 13
Joined: 13 Sep 2019, 11:10
Contact:

Re: Interaction Triggers no longer working in 3.1.x

02 Nov 2021, 11:31

This won't work because Preview will happen before SelectedItem is set in the ListView. This behavior seems specific to Noesis as in WPF, it still work as intended with Preview.
 
User avatar
sfernandez
Site Admin
Posts: 2415
Joined: 22 Dec 2011, 19:20

Re: Interaction Triggers no longer working in 3.1.x

02 Nov 2021, 11:56

If you are interested in the SelectedItem, won't be easier to just bind to that property in the ListView instead of using a command and bind to the SelectedItem in the parameter?
<ListView  x:Name="PlayersRankingView" ItemsSource="{Binding Players}" SelectedItem="{Binding SelectedPlayer}" Margin="20,10,20,10">
 
User avatar
ttermeer-reboundcg
Topic Author
Posts: 13
Joined: 13 Sep 2019, 11:10
Contact:

Re: Interaction Triggers no longer working in 3.1.x

02 Nov 2021, 14:31

Yes this works. Not sure what was the reason it was done this way.

Who is online

Users browsing this forum: No registered users and 2 guests