Я пытаюсь расположить прямоугольник в InkCanvas
.Я использую следующий метод.К сожалению, когда я добавляю прямоугольник, он отображается на (0,0)
.Хотя, когда я запрашиваю, чтобы увидеть, является ли свойство left 0
, я получаю ненулевые значения.Кто-нибудь знает, почему это может быть?
Приветствия,
Нилу
InkCanvas _parent = new InkCanvas();
private void AddDisplayRect(Color annoColour, Rect bounds)
{
Rectangle displayRect = new Rectangle();
Canvas.SetTop(displayRect, bounds.Y);
Canvas.SetLeft(displayRect, bounds.X);
// check to see if the property is set
Trace.WriteLine(Canvas.GetLeft(displayRect));
displayRect.Width = bounds.Width;
displayRect.Height = bounds.Height;
displayRect.Stroke = new SolidColorBrush(annoColour);
displayRect.StrokeThickness = 1;
_parent.Children.Add(displayRect);
}