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

Is there a quick method to copy default button style to a LightVisualElement?

2 Answers 59 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Czeshirecat asked on 13 Jul 2016, 03:18 PM

Hi

I'm writing a subclass of a radtileelement and one of it's child LightVisualElements needs to emulate a button.

I've written the following code which emulates a regular/plain windows button but I wondered if there was a quick method to copy the style from the border primitive belonging to a button on the form to my LightVisualElement so that my element will maintain the appearance of a button border without needing to do it all manually. (Ive not touched theming yet as Ive only been doing this a few days so far and want to start feeling comfortable understanding the controls first.)

 

01._buttonElement = new LightVisualElement();
02._buttonElement.TextAlignment = ContentAlignment.MiddleCenter;
03._buttonElement.AutoEllipsis = true;
04._buttonElement.MinSize = new Size(0, 30);
05. 
06._buttonElement.DrawFill = true;
07._buttonElement.BackColor = SystemColors.ButtonFace;
08. 
09._buttonElement.DrawBorder = true;
10._buttonElement.BorderBoxStyle = BorderBoxStyle.FourBorders;
11._buttonElement.BorderBottomColor = SystemColors.ButtonShadow;
12._buttonElement.BorderRightColor = SystemColors.ButtonShadow;
13._buttonElement.BorderTopColor = SystemColors.ButtonHighlight;
14._buttonElement.BorderLeftColor = SystemColors.ButtonHighlight;

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 14 Jul 2016, 06:58 AM
Hi Claire,

Thank you for writing.

You can use RadButtonElement instead of LightVisualElement. In addition, there is no quick way to copy the button styles since they are set in the theme. 

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

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Czeshirecat
Top achievements
Rank 2
Iron
Iron
answered on 15 Jul 2016, 11:37 AM
Even better! Thanks very much
Tags
Themes and Visual Style Builder
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Answers by
Dimitar
Telerik team
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Share this question
or