[Solved] Having trouble with page opens with a list of icon buttons

I’m having an issue when trying to navigate between pages using a list of navigation buttons.

Currently I have the following logic for each button:
Each icon is set as a Toggle Button
Each icon has two triggers:
Property Trigger (Trigger) (IsChecked/True)
Has two setters:
set Icon to a selected state
set button isEnabled to false
EventTrigger (Event: Clicked)
all other icons in menu property “IsChecked” is set to “False”

I added a MethodAction to my EventTrigger:
Target: App
Method: GoToPage
Parameters: Dashboard.xaml

I can get the page to change by clicking on the button, but the problem I’m running into is that my button doesn’t seem to change its state when clicked. I have to click it 2x for it to be highlighted (it seems like my button actions aren’t executing when selecting the icon to open a new page). When I don’t include the GoToPage method, the icons behave as expected.

I might be doing something wrong, but can’t figure it out.

Any help would be greatly appreciated.

Thanks!

EDIT: Attached is a sample project I put together to illustrate my issue.
IconPageSelectIssueExample.hrp (132.9 KB)

Change your buttons from toggles to normal

Thanks for the suggestion @Tarkus. I switched the buttons to normal instead of toggle and changed the events to be “pressed” instead of “checked” but my project keeps crashing when I try to load it in the emulator. Not sure what’s going on there.

When I run it on my tablet the buttons aren’t changing states as I want them to when they are set as normal buttons. They are just staying in the “selected” state.

I did nothing other than change the buttons to normal on your supplied project and it worked fine. Give that a try.

I’m surprised it worked for you as my logic was using “isChecked” which only works for toggle buttons. The page change by itself isn’t the issue. It’s that when I select an Icon, I need the icon to change to a “selected” state. With the example I provided, you have to select the icon a second time to get it to be in a “selected” state.

Also, try deleting the OpenPage action in both buttons, then select each button. You’ll see that the Icons are selected properly on the first try. Wondering if there’s a bug?

Okay I think I solved this. It’s not a bug, but rather a poor implementation on my part. I had setup my workflow to have a navigation page which I would add to each screen. I think this was the source of the problem. Instead, I created a “base” page that contained the navigation and every “screen” is loaded into a PageBrowser that lives within the “base” page. In doing this, the page now loads properly with the icon in a selected state.

See my revised example.
IconPageSelectIssueExampleRev.hrp (132.8 KB)

1 Like