This example shows how to include an image on a Button.
The following example creates two Button controls. One Button contains text and the other contains an image. The image is in a folder called data, which is a subfolder of the example’s project folder. When a user clicks the Button that has the image, the background and the text of the other Button change.
This example creates Button controls by using markup but uses code to write the Click event handlers.
<Button Name="btn5" Width="50" Height="30" Click="OnClick5">
<Button Name="btn6" BorderBrush="Black">Click the picture.</Button>
Private Sub OnClick5(ByVal sender As Object, ByVal e As RoutedEventArgs)
btn6.FontSize = 16
btn6.Content = "This is my favorite photo."
btn6.Background = Brushes.Red