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

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

    Posted 13 Jul Link to this post

    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. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 14 Jul 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.

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Czeshirecat
    Czeshirecat avatar
    14 posts
    Member since:
    Jun 2016

    Posted 15 Jul in reply to Dimitar Link to this post

    Even better! Thanks very much
Back to Top