Can not maximize the child window in wpf
I am rewriting an old application built in FoxPro and my client doesnt want any change in GUI so I have to make an old DOS style GUI application using wpf, and here is where my problem starts. The older application was a full screen application so here too I have to make it full screen no task bars..nothing. Now I changed the properties and everything was working very fine in my first window. but as soon as I use window2.showdialog() to invoke my second window, which too should go full screen BOOM...despite of the fact that I am using identical settings second window leaves some space at bottem (though it is border less and all) now I dont know whats going wrong here....
Here is my first window which 开发者_运维问答works perfectly:
<Window x:Class="WpfAppMT.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:mt="clr-namespace:WpfAppMT"
Title="MT" WindowStyle="None" WindowState="Maximized" ResizeMode="CanResize" SizeToContent="WidthAndHeight" Topmost="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="640" d:DesignWidth="480">
<Viewbox Stretch="Fill">.....</Viewbox></Window>
here is the screens shot of the first window which is perfectly fine:
and this is the xaml of my second window, which when invoked from the first window's event handler is always cut short at bottom
<Window
x:Class="WpfAppMT.accountheads"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="accountheads" Background="#FF008284" WindowStyle="None" WindowState="Maximized" ResizeMode="CanResize" SizeToContent="WidthAndHeight" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="640" d:DesignWidth="480" KeyDown="Window_KeyDown">
.....</Window>
Here you can see that the second window is not full screen but leaves a lot of space at the bottom I dont understand the reason behind this peculiar behavior... Apart from that I am facing a peculiar problem the GUI of application looks different on different OS's...I mean I am devolping it on an XP machine where it looks differently(the positions/length/widths), and today when I tested it on windows 7, there is lot of difference in look. You can see that in the second window text box which was supposed to be at the bottom has come up
OK..so after some trial and error I found the solution, In this case problem was with SizeToContent property I have set it to WidthandHeight but it should be set to Manual, so this answers the full screen question but still the prolem with portability persists
精彩评论