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

    Hello,

    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.

    Thanks,
    Pawan 
  2. Stefan
    Admin
    Stefan avatar
    2890 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,
    Stefan
    the Telerik team

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

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top