We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Button state not being set

I’m having trouble making 2 sync fusion buttons act like radio buttons. When either of the buttons is pressed they change the other button state to "Default" which makes the button look depressed. This works fine the first time but after that if the button doesn't have focus and you click it, it only receives focus but doesn't become pressed. Below are the steps to recreate it and I’ve included a sample app.

1) Click buttonAv1 - buttonAv1 changes to pressed
2) Click buttonAv2 - buttonAv2 changes to pressed and buttonAv1 changed to depressed (state = Default)
3) Click buttonAv1 - buttonAv2 changes to depressed and buttonAv1 gets focus but I would have expected buttonAv1 to become pressed


WindowsApplication1.zip

1 Reply

RA Rajagopal Syncfusion Team September 13, 2007 01:36 AM UTC

Hi Shane,

Thanks for your interest in Syncfusion Products.

Please try the code below to get this working properly in changing the states of the button when either of the button is clciked.

// buttonAdv1_Click
buttonAdv1.State = ButtonAdvState.Pressed;
buttonAdv2.State = Syncfusion.Windows.Forms.ButtonAdvState.Default;
buttonAdv2.Invalidate();

// buttonAdv2_Click
buttonAdv2.State = ButtonAdvState.Pressed;
buttonAdv1.State = Syncfusion.Windows.Forms.ButtonAdvState.Default;
buttonAdv1.Invalidate();

Let me know if you have any other questions.

Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon