RadToggleButton Bug.

2 posts, 0 answers
  1. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 06 May 2015 Link to this post

    Using the code bellow which add a radio button to a RadToggleButton. Whenever i click the button and not the radio button. The radio button automatically toggles on as well. But if you change RadToggleButton to a RadButton then it works. It also hapens with RadCheckBoxElement as well.

                RadToggleButton button = new RadToggleButton();
                button.Text = "Test";
                RadRadioButtonElement e = new RadRadioButtonElement();
                e.ToggleStateChanged += e_ToggleStateChanged;
                e.CheckStateChanged += e_CheckStateChanged;
                e.Margin = new System.Windows.Forms.Padding(button.Width-18, 0, 0, 0);
                button.ToggleStateChanged += button_ToggleStateChanged;


  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 11 May 2015 Link to this post

    Hi Hugues,

    Thank you for writing.

    In this case the only the visual state of the element is changed by the theme. As you can see the ToggleStateChanged event is not fired unless the radio button is clicked. So to avoid this you can use RadHostItem and add RadRadioButton:
    RadToggleButton button = new RadToggleButton();
    button.Text = "Test";
    button.Location = new Point(30, 30);
    RadRadioButton radio = new RadRadioButton();
    RadHostItem item = new RadHostItem(radio);
    radio.ToggleStateChanged += e_ToggleStateChanged;
    radio.CheckStateChanged += e_CheckStateChanged;
    item.StretchHorizontally = false;
    item.StretchVertically = false;
    item.Alignment = ContentAlignment.MiddleRight;
    item.ShouldHandleMouseInput = true;
    item.NotifyParentOnMouseInput = false;

    I hope this helps. Should you have any other questions do not hesitate to ask.

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top