WPF window Maximization

Source: Internet
Author: User

C/S application process, to achieve a function is to be able to edit the system of a certain type of table, these tables contain different properties,properties number is not the same, there are 20 or so, there are one or two, so, the popup after the size of different, very bad to see, And this view inherits from the parent class ViewModel, this model does not have the maximization setting, my final solution is to give the base class new attribute, the subclass sets this property according to the need, and then the view initializes the time to judge, but, at the beginning directly uses

Windowstate.maximized () This method, but it does not worked, and replaced by this:

This. left = 0;//Set position
This. Top = 0;
Rect rc = systemparameters.workarea;//get the workspace size
This. Width = RC. Width;
This. Height = RC. Height;

Still it does not worked,

The final consideration is not me. When the view itself is initialized (the subject of the view is the DataGrid) there is a setting for the Fild related property of the DataGrid, and this windowstate conflict, eventually using the DataGrid's properties.

So add it behind the first line of code: ()

ContentControl

WPF window Maximization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.