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

3 posts, 1 answers
  1. Czeshirecat
    Czeshirecat avatar
    54 posts
    Member since:
    Jun 2016

    Posted 13 Jul 2016 Link to this post


    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);
    06._buttonElement.DrawFill = true;
    07._buttonElement.BackColor = SystemColors.ButtonFace;
    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. Answer
    Dimitar avatar
    2563 posts

    Posted 14 Jul 2016 Link to this post

    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.

    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.
  3. Czeshirecat
    Czeshirecat avatar
    54 posts
    Member since:
    Jun 2016

    Posted 15 Jul 2016 in reply to Dimitar Link to this post

    Even better! Thanks very much
Back to Top