I have a list of Rectangle shapes which I keep in memory,
I want to bind this list of rectangles to a Grid so that the Grid will display the rectangles as its children.
So when I update this list of rectangles (adding, removing) it would be updated in the display.
I know I can do this programatically by accessing the children property of the Grid and adding and removing the rectangles but for difficult reasons to explain I want to use the Binding feature….
Is this possible?
Thanks
You should use an itemscontrol in this case, since binding directly to the Children property of a panel is not possible. See this example for the same situation, except that it’s using a canvas.