如何:从页面设置窗口的宽度

更新:2007 年 11 月

此示例演示如何从 Page 设置窗口的宽度。

示例

Page 可以通过设置 WindowWidth 来设置承载它的窗口的宽度。使用此属性,无需明确了解承载 Page 的窗口的类型。

说明:

若要使用 WindowWidth 来设置窗口的宽度,Page 必须为窗口的子级。

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