<Window x:Class="LayoutPanels.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Menu" Height="375.2" Width="252">
<Grid>
<StackPanel Margin="5" Button.Click="ButtonClick">
<Button>SimpleStack</Button>
<Button>SimpleWrap</Button>
<Button>SimpleDock</Button>
<Button>BasicDialogBox</Button>
<Button>SimpleGrid</Button>
<Button>SplitWindow</Button>
<Button>DoubleSplitWindow</Button>
<Button>SharedSizeGroup</Button>
<Button>SimpleCanvas</Button>
<Button>SimpleInkCanvas</Button>
<Button>TheUniformGrid</Button>
<Button>TextBoxColumn</Button>
<Button>LocalizableText</Button>
<Button>ModularContent</Button>
</StackPanel>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Reflection
Namespace LayoutPanels
Public Partial Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub ButtonClick(sender As Object, e As RoutedEventArgs)
Dim cmd As Button = DirectCast(e.OriginalSource, Button)
Dim type As Type = Me.[GetType]()
Dim assembly As Assembly = type.Assembly
Dim win As Window = DirectCast(assembly.CreateInstance("YourNameSpace." & Convert.ToString(cmd.Content)), Window)
win.ShowDialog()
End Sub
End Class
End Namespace