Is it possible to set and keep a button in isChecked state?

What I’m looking for is the ability to check a button/icon and have it be in a “checked” state and stay there, so if a user selects it again, it stays “checked”.

Big picture is I have several navigation icons, and I would like only one of those to be able to be in a “checked” state at a time. So if a user checks one button/icon, then they have to check another button/icon to change the state of the previously checked button/icon.

Hope that makes sense?

Thanks!

I think the better option would be to use the RadioButton. That sort of functionality is built into that control. Just assign every control to the same GroupName.

If you really want to use a button, you can. The IsChecked property is writable so you can have the “Clicked” event on your button uncheck all of the other buttons by setting IsChecked to False. You’re just going to have quite a few EventTriggers & Setters to configure.

Okay. Cool. I’ll give the RadioButton a try. If I use a button, I figured I could set the IsChecked property to unchecked, but that doesn’t prevent users from selecting the same button again and changing its IsChecked state. Hopefully, RadionButton will be the solution. I’ll report back if it doesn’t work for my use case. Thanks Bill.

Is it possible to use icons for the radio buttons? I don’t see any parameters to use an icon instead of the default radio button and text.

Sorry, there’s no way to provide custom icons to the RadioButton.

Okay. I’m able to simulate the radio button behavior via a button based on your suggestion. The only problem I’m having is that if a user clicks on the same button 2x then it will be isClicked = false, which I don’t want. To fully simulate the radio button behavior, I want the button that was selected to remain clicked if the user selects it multiple times. Is there a way I can mimic that?

Thanks!

I tried setting isEnabled = False, which kind of works, but it seems to be tinting my Icon dark.

Okay. I think I came up with a solution. So far it’s only a theory as I haven’t created my screens yet that will react to the menu icons, but I think it will work.

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
change ButtonType to “Button”
EventTrigger (Event: Clicked)
all other icons in menu property “IsChecked” is set to “False”

I know this seems a bit convoluted and a lot of setup, but it seems to be the only way to mimic the radio button behavior but with custom icons.

IsEnabled=False styling may differ in the actual apps.

IsEnabled=False does look different in app vs designer. Check it before ruling it out.

I’ll give it a try in the app. Thanks, @bill and @Tarkus

Confirmed that isEnabled looks correct in the app while incorrect in the emulator. Thanks @Tarkus