You need to create a new WPF application. After that you should have a .xaml file and a .cs file. They represent your main window. Create an additional .xaml and .cs file to present your additional window.
MainWindow.xaml
<Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Content="Open Window" Click="ButtonClicked" Height="25" HorizontalAlignment="Left" Margin="379,264,0,0" Name="button1" VerticalAlignment="Top" Width="100" /> </Grid> </Window>
MainWindow.xaml.cs
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void ButtonClicked(object sender, RoutedEventArgs e) { SubWindow subWindow = new SubWindow(); subWindow.Show(); } }
Then add the extra code needed for these classes:
SubWindow.xaml SubWindow.xaml.cs
TokyoMike Jun 21 '12 at 8:32 2012-06-21 08:32
source share