-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to replace RadioButton with ToggleButton ? #4373
Comments
This is supposed to be an error in the UWP framework as well : |
|
RadioButtons doesn't actually require its children to be of type radio button. It only requires that they be toggle buttons (a base class of RadioButton) so you should just be able to do something like:
|
check out this issue which talked about retemplating radio buttons while using toggle buttons #3759 |
@StephenLPeters, Thanks. |
However, I still believe the |
Can you give some more details on what your are trying to accomplish? I'm pretty unsure based on the discussion so far. Maybe we can recommend something simpler. |
@StephenLPeters , sure, very simple. Just 2 buttons toggling mutual each other as ; These are now 2 standalone toggle buttons. my curiosity was driving me to another solution with the radio buttons, where TempleteBinding isn't working the way I was expecting. I expected that manipulating the ThemeIndex -> will change IsChecked -> will reflect to the ToggleButton's IsChecked property. |
Ah, okay. So I think that RadioButtons is actually depending on code that exists in RadioButton in system xaml to enforce the mutually exclusive nature of radio button elements. So I think you are going to have trouble retemplating RadioButtons for this scenario. I would recommend using actual check boxes with something to manage the exclusive checked state of them. You could either attach a Checked handler on them, to uncheck the other. Or you could use a TwoWay binding and a converter (that converts true to false and false to true) to tie the IsChecked property of the two toggle buttons together. |
@StephenLPeters Thanks! That is more complicated than laying out 2 standalone buttons. I did believe I could harness the |
I forged this but have bugs, what is your take on ?
This isn't working properly.
How would you solve these ?
The text was updated successfully, but these errors were encountered: