In traditional desktop app, I perform my custom canvas drawing as follow
class ChartingView : System.Windows.Controls.Canvas
{
protected override void OnRender(DrawingContext drawingContext)
{
// ... All the juicy drawing code right here.
}
}
However, how about in Metro? As in Windows.UI.Xaml.Controls.Canvas, I cannot find OnRender method for me to override.
You can use Children property to populate
Canvas. You can put there primitives (shapes, lines, etc.) as well as “complex” controls. And as noted in the @Aaron Murgatroyd comment:To adjust them on the
Canvasyou should useCanvas.SetXYZmethods (see for example Canvas.SetLeft and Canvas.SetTop methods).