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

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

4 Answers 145 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Jacky
Top achievements
Rank 1
Jacky asked on 09 Jun 2014, 08:15 AM
I tried it. but the background image does not work for me.

What's wrong?

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 Jun 2014, 08:48 AM
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.
 
0
Jacky
Top achievements
Rank 1
answered on 09 Jun 2014, 09:51 AM
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?
0
Accepted
Stefan
Telerik team
answered on 10 Jun 2014, 08:37 AM
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.
 
0
Jacky
Top achievements
Rank 1
answered on 11 Jun 2014, 04:31 AM
Thanks Stefan.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Jacky
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Jacky
Top achievements
Rank 1
Share this question
or