I'm drawing a selection box when I click and drag on my canvas object (which extends Canvas). I have overridden the OnRender method like so:
protected override void OnRender(DrawingContext dc)
{
base.OnRender(dc);
DrawGrid(dc);
DrawSelector(dc);
}
private void DrawSelector(DrawingContext dc)
{
if (Selecting)
{
dc.DrawRectangle(new SolidColorBrush(Color.FromArgb(75, 0, 0, 255)), new Pen(Brushes.Blue, 1.5), SelectionRect);
}
}
But my selector is always drawn UNDER all the elements on the canvas. Does anyone know how I would draw my selector OVER all the UIElements on my canvas?
Thanks.