在canvas上绘制单个点的有效方法

我正在寻找一种在C#canvas上绘制单点(带颜色)的方法。 在android中我会做类似的事情

paint.Color = Color.Rgb (10, 10, 10); canvas.DrawPoint (x, y, paint); 

所以我认为我可以在Shape类中找到它,但它不存在。 我错过了什么或者没有办法画出一点吗?

在第二种情况下,推荐的绘制点的方法是什么? 在HTML5canvas中存在类似的问题,人们使用矩形/圆形绘制点。

PS一个类似标题的问题Add Point to Canvas没有回答它并进入“如何绘制形状”。

我刚刚为UWP运行了同样的问题,我最终决定使用Ellipse:

 int dotSize = 10; Ellipse currentDot = new Ellipse(); currentDot.Stroke = new SolidColorBrush(Colors.Green); currentDot.StrokeThickness = 3; Canvas.SetZIndex(currentDot, 3); currentDot.Height = dotSize; currentDot.Width = dotSize; currentDot.Fill = new SolidColorBrush(Colors.Green); currentDot.Margin = new Thickness(100, 200, 0, 0); // Sets the position. myGrid.Children.Add(currentDot); 

折线怎么样?

XAML:

      

C#:

 private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { polyline.Points.Add(new Point(0,0)); polyline.Points.Add(new Point(0, 1)); polyline.Points.Add(new Point(1, 0)); polyline.Points.Add(new Point(1, 1)); }