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

Default Backcolor for Button Fill Element

1 Answer 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pawa
Top achievements
Rank 1
Pawa asked on 06 Aug 2011, 05:02 PM
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 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 10 Aug 2011, 04:03 PM
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 >>

Tags
General Discussions
Asked by
Pawa
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or