Search This Blog

Wednesday, October 19, 2016

Get rectangles from canvas WPF code behind

WPF > Controls > Layout > Canvas > Children


Example 

Get all rectangles from canvas.

private List<Rectangle> GetRectangles()
{
    return canvas.Children.OfType<Rectangle>().ToList();

}