Put Button onto a Grid
<Window x:Class="MyFirstWPFApp.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MyFirstWPFApp" Height="336" Width="343">
<Grid>
<Button Click="MyClickEvent"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Grid.Column="0"
Grid.ColumnSpan="1"
Grid.Row="0"
Grid.RowSpan="1"
Margin="43,61,0,0"
Width="75"
Height="23"
Name="btnGo">Go</Button>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Namespace MyFirstWPFApp
Public Partial Class Window1
Inherits System.Windows.Window
Private Sub MyClickEvent(sender As Object, e As RoutedEventArgs)
MessageBox.Show("Elexzandreia the beautiful!", "Message", MessageBoxButton.OK, MessageBoxImage.Hand)
End Sub
Public Sub New()
InitializeComponent()
End Sub
End Class
End Namespace
Related examples in the same category