How to Set Height of a Page in WPF Application

By Mahesh Chand Oct 07, 2011
Recently, I have been working on a WPF application that has some Windows and Pages. A Page is hosted within a Windows in an XBAP application.

How to Set Height of a Page in WPF Application

Recently, I have been working on a WPF application that has some Windows and Pages. A Page is hosted within a Windows in an XBAP application. The Height, MaxHeight and MinHeight properties do not apply to a Page. The only way you could change the height of a page is using the WindowHeight property.

The following code snippet sets a Page height.

<Page 

       WindowHeight="860"
       WindowWidth="1024"
       Width="1200" Height="768">

You can also set this dynamically from the code on the class constructor or anywhere else.

public DashboardAdministrator()
{

this.InitializeComponent();      

       this.WindowHeight = 860;
       this.WindowWidth = 1024; 

}


Related Readings

Mahesh Chand

Mahesh Chand is founder of C# Corner. C# Corner founded in 1999 is a FREE member contributions based open platform for developers to solve problems, learn new technology and hang out.  Mahesh has been awar... Read more

COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs