Is it possible to set backgroundimage to ToggleButton instead of backcolor?

5 posts, 1 answers
  1. Jacky
    Jacky avatar
    23 posts
    Member since:
    Mar 2014

    Posted 09 Jun 2014 Link to this post

    I tried it. but the background image does not work for me.

    What's wrong?

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 09 Jun 2014 Link to this post

    Hi Jacky,

    Thank you for writing.

    In order to show the button's BackgroundImage, you have to hide its fill:
    RadToggleButton button = new RadToggleButton();
    button.Parent = this;
    button.BackgroundImage= Resources.folder;
    button.ButtonElement.ButtonFillElement.Visibility = ElementVisibility.Collapsed;

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jacky
    Jacky avatar
    23 posts
    Member since:
    Mar 2014

    Posted 09 Jun 2014 Link to this post

    Must the fill be hidden? 
    I want to show the background image on normal state,   and show fill on other states (mouseover,  toggleon etc.),  

    as attached,  the first button is normal state (toggle off and no mouseover),  the background image was displayed.
    the second button is mouseover or toggleon state, the fill should be displayed.

    is it possible and controlled by theme?
  5. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 10 Jun 2014 Link to this post

    Hi Jacky,

    You can do that in theme. Simply set an Image for the default state and set an empty image for the rest of the states of the button. Attached you can find a video demonstrating how to do this.

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Jacky
    Jacky avatar
    23 posts
    Member since:
    Mar 2014

    Posted 10 Jun 2014 Link to this post

    Thanks Stefan.
Back to Top
UI for WinForms is Visual Studio 2017 Ready