controller B nav sometimes triggers multiple times, sometimes not at all
Posted: 05 Apr 2021, 21:52
Hello,
Our controller B nav sometimes triggers multiple times, sometimes not at all .. depending on order of frames in main window.
Our mainwindow.xaml has the frames like so, note "page" is is what is currently visible, each page has a Back button.
Buttons in each screen are defined as so (note empty command param is does default back).
Expectation: Flow is ScreenA > ScreenB > ScreenC
Problem 1: Pressing "B" on Screen C, will take you all the way back to screen A. Binding "Navigate" will trigger twice. However, inspector confirms that at any one point only one "ButtonBack" property "IsVisible" is set to true.
We think that act of pressing "B" changes the "page" and input sometimes gets forwarded to next page even though it should have been consumed in the last button press.
Caviat: if we order mainwindow.xaml to be like so, the problem of double back goes away. Binding "Navigate" is triggered only once.
It's a bit of a short term solution for us as we expect some flows to be non linear.
Question 1: why does order of things in mainwindow.xaml matter?
Question 2: Is it the case of non-consumed back input? How does one force consume input in a button? Or something else you think might be happening?
Problem 2: EDIT: Problem 2 solved, see next post On a branching screen flow sometimes "B" just doesn't get triggered, Binding "Navigate" will not trigger.
It is not the matter of <ei:ConditionBehavior>, problem persists with or without.
This worked literally 4 days ago before more screens were added (ala my previous post about triggering buttons from cpp. )
However, I'm still trying to boil down the problem to a simple example.
I only have a suspicion it's to do with some kind of focus issue, something else is capturing the input. The Inspector says the current focus is still on an element of last screen that is currently not visible, so it might be consuming input but not acting on it? My dud screen that doesn't go back does have SetFocusAction, which worked elsewhere, though we disabled focus entirely on that page as nothing can be in focus. This page did not change in days .. so problem is created elsewhere, possibly on earlier page that forces focus on input text.
Our controller B nav sometimes triggers multiple times, sometimes not at all .. depending on order of frames in main window.
Our mainwindow.xaml has the frames like so, note "page" is is what is currently visible, each page has a Back button.
Code: Select all
<Frame x:Name="ScreenC" Width="1920" Height="1080" Source="Views/ScreenC.xaml" Focusable="False" />
<Frame x:Name="ScreenB" Width="1920" Height="1080" Source="Views/ScreenB.xaml" Focusable="False" />
<Frame x:Name="ScreenA" Width="1920" Height="1080" Source="Views/ScreenA.xaml" Focusable="False" />
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding page}" Value="{StaticResource VIEW_SCREENA}">
<ei:ChangePropertyAction PropertyName="Visibility" TargetName="ScreenA" Value="Visible" />
</ei:DataTrigger>
<ei:DataTrigger Binding="{Binding page}" Comparison="NotEqual" Value="{StaticResource VIEW_SCREENA}">
<ei:ChangePropertyAction PropertyName="Visibility" TargetName="ScreenA" Value="Hidden" />
</ei:DataTrigger>
<!-- more triggers for B/C -->Code: Select all
<Button Name="ButtonBack" Style="{StaticResource MenuButtonStyle}" Command="{Binding Navigate}" CommandParameter="" Focusable="False" >
<i:Interaction.Triggers>
<noesis:GamepadTrigger FiredOn="ButtonDown" Button="Cancel">
<i:InvokeCommandAction Command="{Binding Navigate}" CommandParameter=""/>
<i:Interaction.Behaviors>
<ei:ConditionBehavior>
<ei:ConditionalExpression>
<ei:ComparisonCondition LeftOperand="{Binding Path=IsVisible, ElementName=ButtonBack}" Operator="Equal" RightOperand="True"/>
</ei:ConditionalExpression>
</ei:ConditionBehavior>
</i:Interaction.Behaviors>
</noesis:GamepadTrigger>
</i:Interaction.Triggers>
<Button.Content>
<!-- button contents -->Expectation: Flow is ScreenA > ScreenB > ScreenC
Problem 1: Pressing "B" on Screen C, will take you all the way back to screen A. Binding "Navigate" will trigger twice. However, inspector confirms that at any one point only one "ButtonBack" property "IsVisible" is set to true.
We think that act of pressing "B" changes the "page" and input sometimes gets forwarded to next page even though it should have been consumed in the last button press.
Caviat: if we order mainwindow.xaml to be like so, the problem of double back goes away. Binding "Navigate" is triggered only once.
Code: Select all
<Frame x:Name="ScreenA" Width="1920" Height="1080" Source="Views/ScreenA.xaml" Focusable="False" />
<Frame x:Name="ScreenB" Width="1920" Height="1080" Source="Views/ScreenB.xaml" Focusable="False" />
<Frame x:Name="ScreenC" Width="1920" Height="1080" Source="Views/ScreenC.xaml" Focusable="False" />Question 1: why does order of things in mainwindow.xaml matter?
Question 2: Is it the case of non-consumed back input? How does one force consume input in a button? Or something else you think might be happening?
Problem 2: EDIT: Problem 2 solved, see next post On a branching screen flow sometimes "B" just doesn't get triggered, Binding "Navigate" will not trigger.
It is not the matter of <ei:ConditionBehavior>, problem persists with or without.
This worked literally 4 days ago before more screens were added (ala my previous post about triggering buttons from cpp. )
However, I'm still trying to boil down the problem to a simple example.
I only have a suspicion it's to do with some kind of focus issue, something else is capturing the input. The Inspector says the current focus is still on an element of last screen that is currently not visible, so it might be consuming input but not acting on it? My dud screen that doesn't go back does have SetFocusAction, which worked elsewhere, though we disabled focus entirely on that page as nothing can be in focus. This page did not change in days .. so problem is created elsewhere, possibly on earlier page that forces focus on input text.
Code: Select all
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded"> <!-- MouseEnter, or Targetname doesn't this work -->
<noesis:SetFocusAction />
</i:EventTrigger>
</i:Interaction.Triggers>