我正在以编程方式将控件添加到画布中,这很棒......
var newControlPoint = new ControlPoint() { Width = 10, Height = 10 };
newControlPoint.SetResourceReference(Control.TemplateProperty, "ControlPoint");
SetCanvasPosition(newControlPoint, position.X - (newControlPoint.Width / 2), position.Y - (newControlPoint.Height / 2));
canvas.Children.Add(newControlPoint);
newControlPoint.UpdateLayout();
...但是当我尝试从第一行删除硬连线的宽度和高度设置时,我正在解开...
var newControlPoint = new ControlPoint();
...画布定位似乎没有生效,新创建的控件在{0,0}处结束。
有什么想法吗?
答案 0 :(得分:0)
两个问题:
要解决此问题,您可以: