#341 – Create a Button with an Image and Text
July 13, 2011 6 Comments
Since a Button is a ContentControl, it can have any other control as its content, rather than text. You can include an Image control, to create a button with an image on its face. You can also include multiple controls on the button, by settings its main content to be a container, which in turn contains other controls.
In the example below, we create a Button that has both an image and some text (a caption).
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" > <StackPanel> <Image Source="Misc-Settings-icon.png" Height="64" Width="64"/> <Label Content="Settings" HorizontalAlignment="Center"/> </StackPanel> </Button>