This is a migrated thread and some comments may be shown as answers.

Change radiobutton colour when hovered

1 Answer 412 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Kgopelo
Top achievements
Rank 1
Kgopelo asked on 01 Aug 2014, 08:27 AM
Hey all.I have been searching to change a background colour of a radbutton when hovered.I found exactly what I was looking for here
When I run the program, all is well.But when I try to implement that exact code in my project it does not work.Is there something I am missing.Bear with me as I am a newbie.

Kind Regards,

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 Aug 2014, 07:31 AM
Hello Kgopelo,

Thank you for writing.

The provided example just changes the BackColor when the button is not hovered. To change the hover color you can use the MouseEnter and MouseLeave events: 
void radButton1_MouseLeave(object sender, EventArgs e)
{
    radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.BackColorProperty,
        Telerik.WinControls.ValueResetFlags.Local);
    radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.GradientStyleProperty,
        Telerik.WinControls.ValueResetFlags.Local);
}
 
void radButton1_MouseEnter(object sender, EventArgs e)
{
    radButton1.ButtonElement.ButtonFillElement.BackColor = Color.FromArgb(153, 204, 55);
    radButton1.ButtonElement.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Kgopelo
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or