RibbonBar:RadButtonElement

3 posts, 0 answers
  1. Baboi
    Baboi avatar
    2 posts
    Member since:
    Oct 2015

    Posted 08 Oct 2015 Link to this post

     I add a new RadButtonElement in RadRibbonBarGroup and Set the image of RadButtonElement . When the cursor over the button, the button's color(?) changes.

    Like the attach images.

    But I wrote following code, it do not have the same change when  the cursor over the button.

    So I want ask which property can achieve that。

    .

     

     

  2. Baboi
    Baboi avatar
    2 posts
    Member since:
    Oct 2015

    Posted 08 Oct 2015 in reply to Baboi Link to this post

    Sorry, The code:

     RadButtonElement btnChangePassword = new RadButtonElement();
                    btnChangePassword.ButtonFillElement.BackColor = Color.Transparent;
                    btnChangePassword.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
                    btnChangePassword.Class = "RibbonBarButtonElement";
                    btnChangePassword.Click += btnChangePassword_Click;
                    btnChangePassword.Image = Properties.Resources.Config_Default;
                    btnChangePassword.Margin = new Padding(0, 20, -20, 0);
                    btnChangePassword.TextImageRelation = TextImageRelation.ImageAboveText;
                    btnChangePassword.BorderElement.Visibility = ElementVisibility.Hidden;
                    this.radRibbonBarMain.RibbonBarElement.ButtonsContainer.Children.Insert(0, btnChangePassword);​

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 09 Oct 2015 Link to this post

    Hello Baboi,

    Thank you for writing.

    The local value, applied to the BackColor property, overrides the applied styles coming from the theme. That is why the applied color for the hover state is lost. Since Q3 2015 we have introduced a new API for changing the style for a specific element state without losing the applied style for the rest of the states. Please refer to the Override Theme Settings at Run Time help article which demonstrates how to change the BackColor without losing the hover style.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top