Reputation: 115
How do I direct to another xaml
user control page from my main window when i click the button from my main window.
private void button1_Click(object sender, RoutedEventArgs e)
{
\\what am i suppose to write here;
}
Thanks any help appreciated
my code on my catergory xaml
<UserControl x:Class="KinectButton.view.Catergory"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="373" d:DesignWidth="480" HorizontalAlignment="Stretch" Loaded="UserControl_Loaded">
<Grid Loaded="Grid_Loaded" Name="grid1">
<StackPanel Name="myStackPanel" Margin="1,0,120,54">
<Image Height="319" Name="myImg" Stretch="Fill" Width="357" />
</StackPanel>
<Grid x:Name="ContentPanel" Margin="0,0,121,54"></Grid>
<Label Content="Label" Name="message" Margin="2,317,121,0" />
<Button x:Name="Button1" Content="" Margin="357,77,0,222" Click="Button1_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\103159T\Desktop\KinectButton1\KinectButton\Images\AERO.png"></ImageBrush>
</Button.Background>
</Button>
<Button x:Name="Button3" Content="" Margin="357,147,0,148" Click="Button3_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\103159T\Desktop\KinectButton1\KinectButton\Images\MIT.png"></ImageBrush>
</Button.Background>
</Button>
<Button x:Name="Button4" Content="" Margin="357,224,0,0" Height="73" VerticalAlignment="Top" Click="Button4_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\103159T\Desktop\KinectButton1\KinectButton\Images\MECHATRONIC.png"></ImageBrush>
</Button.Background>
</Button>
<Button x:Name="Button5" Content="" Margin="357,298,0,0" Click="Button5_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\103159T\Desktop\KinectButton1\KinectButton\Images\TMT.png"></ImageBrush>
</Button.Background>
</Button>
<Button x:Name="Button2" Content="" Margin="357,0,0,294" Click="Button2_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\103159T\Desktop\KinectButton1\KinectButton\Images\ECC.png"></ImageBrush>
</Button.Background>
</Button>
</Grid>
i have a few buttons and some image on it..
Upvotes: 0
Views: 3994
Reputation: 4882
The code to open a window is pretty easy
private void button1_Click(object sender, RoutedEventArgs e)
{
// based on your comments your window is called catergory
var catergory = new Catergory();
catergory.Show();
}
Upvotes: 1