我只是偶然发现了以下内容:
class AFrameworkElement : FrameworkElement
{
private void SomeMethod()
{
Size s = new Size {
Width = Height = 10
};
// the size isn't used for measuring oder arranging
}
}
突然我无法调整控件的大小... IntelliSense 显示了问题:我把鼠标放在Height
上面,它表明该FrameworkElement.Height
属性是有意义的。那么为什么不可能在对象初始化器中使用双重赋值呢?