Page 1 of 1

Interaction Triggers no longer working in 3.1.x

Posted: 29 Oct 2021, 15:26
by ttermeer-reboundcg
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>

Re: Interaction Triggers no longer working in 3.1.x

Posted: 01 Nov 2021, 12:52
by sfernandez
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?

Re: Interaction Triggers no longer working in 3.1.x

Posted: 02 Nov 2021, 11:31
by ttermeer-reboundcg
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.

Re: Interaction Triggers no longer working in 3.1.x

Posted: 02 Nov 2021, 11:56
by sfernandez
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">

Re: Interaction Triggers no longer working in 3.1.x

Posted: 02 Nov 2021, 14:31
by ttermeer-reboundcg
Yes this works. Not sure what was the reason it was done this way.