【发布时间】:2015-01-24 02:30:15
【问题描述】:
我有一个带有多个导航页面的 WPF 应用程序。到目前为止,应用程序的高度和宽度都在 MainWindow 和每个页面中声明。 所以这里是主窗口
<Window x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My Application" Height="350" Width="725" >
然后每个页面也有如下所示的高度和宽度
<Page x:Class="MyApp.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="350" d:DesignWidth="725"
Title="Page1" >
能否有一个集中的地方,我可以有高度和宽度,而不是在这么多地方?
【问题讨论】:
-
我知道这之前一定有人问过。
-
那个重复与关闭不是同一个问题。重复是一页的大小。
-
@Blam 我有点假设 OP 能够注意到细微差别并计算出将资源放在资源字典中,并将静态资源放在他想要的位置。