当我在 WPF 中创建一个新的 UserControl
时,studio 会创建一些 XAML:
<UserControl x:Class="MOG.Objects.Date.Calender"
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="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>
在 UserContol
中,我还可以添加 Width 属性。 DesignWidth
和 Width
有什么区别?
最佳答案
d:DesignHeight
和 d.DesignWidth
适用于 Visual Studio 或 Expression Blend 中的设计器(所见即所得)。 Height
和 Width
实际上是针对运行时的。
关于c# - WPF中UserControl中DesignWidth和Width的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21871090/