在panel的派生类中找不到children集合
大神求助,
代码(片段)
public partial class uniformstack : Panel
{
protected override Size MeasureOverride(Size availableSize)
{
if (Children.Count == 0)
return new Size();
Size availableChildSize = new Size();
Size maxChildSize = new Size();
Size compositeSize = new Size();
if (Orientation == Orientation.Horizontal)
{
availableChildSize = new Size(availableChildSize.Width / Children.Count,
availableChildSize.Height);
}
else
{
availableChildSize = new Size(availableChildSize.Width,
availableChildSize.Height / Children.Count);
}
return base.MeasureOverride(availableSize);
}
}
children下面一直是红线。显示“当前上下文不存在名称children”
[解决办法]
同样的代码我这里是正常的
[解决办法]
me too
[解决办法]
我这里倒是 if (Orientation == Orientation.Horizontal)出错