Page.WindowWidth 属性

定义

获取或设置 Window 的宿主 NavigationWindowPage 的宽度。

public:
 property double WindowWidth { double get(); void set(double value); };
public double WindowWidth { get; set; }
member this.WindowWidth : double with get, set
Public Property WindowWidth As Double

属性值

Double

直接承载 Page 的窗口的宽度。

示例

以下示例演示如何从页面设置窗口的宽度。

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SetWindowWidthPage"
    WindowWidth="500"
    >
</Page>

注解

WindowWidth 仅在窗口直接托管某个 Page 窗口时应用,其中包括:

如果 a Page 由 a Frame托管,则设置 WindowWidth 不起作用,但仍可以获取其值 WindowWidth

Page XAML 浏览器应用程序中 (XBAP) 只能用于WindowWidth更改 Windows Internet Explorer 的宽度;不能通过设置WidthMinWidthMaxWidth更改宽度。

Windows Internet Explorer 窗口的最小宽度为 250 像素。 对于浏览器托管的页面,这意味着如果会导致 Windows internet Explorer 窗口的总宽度小于 250 像素,则可能不会应用该值WindowWidth

适用于