This project is read-only.

ToggleButton possilbe bug

Nov 2, 2012 at 10:30 AM


I am having some problems with toggle button and trying to change its toggled status with keyboard events.

Using code like this does not work:

private void OnCharEntered(object sender, CharacterEventArgs args) {
            if (args.Character == (char)Keys.D1) {
                t1.IsToggled = true;
                t2.IsToggled = false;                
            else if (args.Character == (char)Keys.D2) {
                t1.IsToggled = false;
                t2.IsToggled = true;
It seems that the setter for IsToggled does not update RenderRule.Mode. Also, initializing IsToggled on creation does not result in the correct visual, using this code added to the test project:

t1 = new ToggleButton(150, 10 + (40 * 0), "Button") {
                        IsToggled = true
t2 = new ToggleButton(150, 10 + (40 * 1), "Wide Button"),

I copied over some code that updates RenderRule.Mode from MouseClick to the setter for IsToggled and this fixed it.

Thank you!

Nov 3, 2012 at 8:33 PM

Thank you added your fix and will push it shortly.