グリッドに動的に形状を追加しようとしています。次のように作成および設定しています。
Rectangle theRect = new Rectangle();
currentRect = theRect;
theRect.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
theRect.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
theRect.Margin = new Thickness(oldPos.X,oldPos.Y,0,0);
theRect.StrokeThickness = brushWidht;
theRect.Stroke = new SolidColorBrush(brushColor);
theRect.Height = newPoint.Y - oldPos.Y;
theRect.Width = newPoint.X - oldPos.X;
theBoard.Children.Add(theRect);
しかし、それは私がそれを置いたグリッドである「theBoard」の隅にくっついています。誰かがこれで私を助けることができますか?ありがとう。