Because
ToggleButton
is a
ContentControl
, it can contain a single child element that can be any .NET object. You typically set the
ToggleButton’s
content to a text string, which appears as a label on the button. But you can also set the content to some other control.
In the example below, the content of each
ToggleButton
in a panel is set to an
Image
control.
<StackPanel HorizontalAlignment="Center" Margin="15">
<Label Content="Click on cartoon characters that you like:"/>
<StackPanel>
<ToggleButton HorizontalAlignment="Center" Margin="5" Padding="5">
<Image Source="001-Bugs.jpg" Stretch="None"/>
</ToggleButton>
<ToggleButton HorizontalAlignment="Center" Margin="5" Padding="5">
<Image Source="002-Underdog.jpg" Stretch="None"/>
</ToggleButton>
<ToggleButton HorizontalAlignment="Center" Margin="5" Padding="5">
<Image Source="003-Betty.jpg" Stretch="None"/>
</ToggleButton>
<ToggleButton HorizontalAlignment="Center" Margin="5" Padding="5">
<Image Source="004-Bart.jpg" Stretch="None"/>
</ToggleButton>
</StackPanel>
</StackPanel>
Sep »
Blog Stats
-
5,379,361 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here:
Cookie Policy