Using WPF MenuItem for both Parent and Child window

Posted by Joewilliam under WPF on 6/14/2011 | Points: 10 | Views : 2021 | Status : [Member] | Replies : 1
This is My Menu Control Coding


<Window x:Class="Flyking.FlykingCourierOperations"
Title="Flyking Courier Operation Manager" Topmost="True" Height="768" Width="1020" WindowStartupLocation="CenterScreen" Background="#f7f4e9" ResizeMode="CanResize" WindowState="Maximized" >
<Grid Background="White">
<Menu Height="40" Margin="0,40,0,0" Name="menu1" VerticalAlignment="Top" Background="#434a48">
<MenuItem Header="Branch" FontSize="13" Foreground="White" Click="MenuItem_Click_4" ToolTip="Open Branch Window" />

private void MenuItem_Click_4(object sender, RoutedEventArgs e)
{ Branch bran = new Branch();
bran.ShowInTaskbar = false;
bran.Owner = Application.Current.MainWindow;

My Second form name is Branch.xaml

Now the question is when i open Branch menu from menuitem(Branch.xaml window) it should be opened within that Menu.xaml window, it should maximize within that Menu.xaml window rather it should not maximize fully as equal to Menu.xaml window. How could i do that.

William Mary


Posted by: Vuyiswamb on: 7/17/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

i see you are trying to do the MDI type of a thing in WPF, ok. if you want to do that you might try to open it as a dialog, so instead of .Show(), try to use .ShowDialog(); and it will open within that window. There are properties of the Child window that you need to set there again. i touched WPF in passing but it should be simple.

Thank you for posting at Dotnetfunda

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response