Here we see how to create Button control and also
explains basic use of the Button control in xaml.
Button control
The Button control allows the user to click it
to perform an action. The Button control display with text and image.
Creating a Button in
XAML
The Button element represents a WPF Button control in XAML.
<Button
Content="Button"
Height="29"
Name="Button1"
Width="200"
/>
The Width and Height attributes of the Button element
represent the width and the height of a Button. The Content property of the
Button element sets the text of a button. Name attribute represents the name of
the control, which is a unique identifier of a control.

Figure1.gif
Important Properties - These are the important
properties of the Button control.
Width - Width property represents the
width of a Button.
Height - Height property represents the
height of a Button.
Content -
The text shown on the button.
Command - Gets or sets the command to
invoke when this button is pressed.
CommandParameter - CommandParameter is
used to pass parameter to the Command property.
ClickMode - Gets or sets when the Click
event occurs.
For example
creating two text boxes, one to input (Label) a
number and other to output (Label)a number and a Buttons.
XAML code
<Label
Content="Number"
Height="28"
HorizontalAlignment="Left"
Margin="10,10,0,0"
Name="Label1"
VerticalAlignment="Top"
/>
<Label
Content="Result"
Height="28"
HorizontalAlignment="Left"
Margin="10,48,0,0"
Name="Label2"
VerticalAlignment="Top"
/>
<TextBox
Height="23"
HorizontalAlignment="Left"
Margin="74,10,0,0"
Name="txtNumber"
VerticalAlignment="Top"
Width="120"
/>
<TextBox
Height="23"
HorizontalAlignment="Left"
Margin="74,48,0,0"
Name="txtResult"
VerticalAlignment="Top"
Width="120"
/>
<Button
Content="Cube"
Height="23"
HorizontalAlignment="Left"
Margin="74,96,0,0"
Name="cmdSquare"
VerticalAlignment="Top"
Width="141"
Background="red"
/>
Now the above code control looks like this.

Figure2.gif
Now double click on the simple button and add the
following code.
Private Sub cmdcube_Click(ByVal
sender As System.Object,
ByVal e As
System.Windows.RoutedEventArgs)
Handles cmdcube.Click
Dim num As Double = Double.Parse(txtNumber.Text)
Dim cu As Double = num * num * num
txtResult.Text = cu.ToString()
End Sub
Now run the application.

Figure3.gif
Now enter the value in the input box.

Figure4.gif