0
votes

I am working with wpf page control. Here I need to start application and open page in maximized state. For window control it is quite easy by setting the state and position, but using page control it is bit tricky.

Below xaml of the first page which is startupuri.

<Page x:Class="MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"

        Title="MainWindow" ShowsNavigationUI="False"  Background="#ffffff">

I am able to height and widht as maximum size using below code:

this.WindowHeight = System.Windows.SystemParameters.MaximizedPrimaryScreenHeight;

this.WindowWidth = System.Windows.SystemParameters.MaximizedPrimaryScreenWidth;

But screens opens at default location with screen overshooting the monitor visual area. Need some help regarding this issue. thanks

1
can't you just maximize the size of the parent windows(where the frame is used)? - SamTh3D3v
Thanks for the suggestion Joseph, i missed that part. - Amit

1 Answers

6
votes

You can set the page's parent Window to maximized state in the page's Loaded event handler, something like:

private void Page_Loaded(object sender, RoutedEventArgs e)
{
     (this.Parent as Window).WindowState = WindowState.Maximized;
}