Change backgroud of button and when mouse over

2 posts, 0 answers
  1. Doraemon
    Doraemon avatar
    7 posts
    Member since:
    May 2013

    Posted 15 Apr 2014 Link to this post


    I want to change background of button. I set FillPrimitive/ BackColor 1- 4 to Blue and background of the button is changed to Blue. But when I move my mouse over the button, background of the button isn't changed to other color.

    1. I want my button background is blue, when I move my mouse over it, the background is changed to yellow or other color. How can I do this ?
    2. I have a lot of buttons in my application so I want apply above style to all my button, How can I do this ?

  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 16 Apr 2014 Link to this post

    Hello James,

    Thank you for writing.

    This is expected because setting the color in code overrides the theme (as it has higher priority) and the color for the mouse over state is not changed. More information about how our theming functionality works can be found in the following articles: 
    This can be very easily overridden by using Visual Style Builder to change the color for the appropriate state. The attached image illustrates how you can change the button color. Also you may find the following articles very useful when you need to use Visual Style Builder: 
    Also you can handle this case in code. To do that you should subscribe to the MouseLeave and MouseEnter events (same handlers can be used for all your buttons):
    void radButton1_MouseLeave(object sender, EventArgs e)
        radButton1.ButtonElement.ButtonFillElement.BackColor = Color.FromArgb(153, 204, 55);
    void radButton1_MouseEnter(object sender, EventArgs e)
        radButton1.ButtonElement.ButtonFillElement.BackColor = Color.FromArgb(153, 204, 255);

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

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top