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

本示例演示如何从一个 Page 设置窗口的宽度。

示例:

A Page 可以通过设置 WindowWidth 来调整主机窗口宽度。 此属性允许 Page 不明确知道承载它的窗口类型。

注释

使用 WindowWidth 设置窗口的宽度时,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>