Default Backcolor for Button Fill Element

2 posts, 0 answers
  1. Pawa
    Pawa avatar
    1 posts
    Member since:
    Jul 2011

    Posted 06 Aug 2011 Link to this post


    I am using a lot of Rad buttons in my application. I change the back color of the buttons based on some conditions the following code:

    .ButtonFillElement.BackColor = Color.LightGreen;
    .ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    .ForeColor = Color.Black;

    My questions is how do i set these properties back to the default ones within code. I want the buttons to get the default theme of the application when the condition turns false.

  2. Stefan
    Stefan avatar
    2908 posts

    Posted 10 Aug 2011 Link to this post

    Hello Pawa,

    Thank you for writing.

    You can reset elements and assign their default values through the ResetValue method. Here is a sample code that resets the ButtonFillElement changes and sets the values introduced by the theme:
    radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
    radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
    radButton1.ButtonElement.ButtonFillElement.ResetValue(FillPrimitive.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);

    I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top