What is the lightest weight: canvas or net?

Sometimes I need to group a couple of elements together, and I don’t need much in terms of layout from the parent panel. Almost any panel will do.

In such cases, is there a clear gain between the different types of panels or are they equivalent?

+3
source share
3 answers

When processing the layout, the canvas is much lighter than the grid.

But you say:

I don’t need much in terms of layout.

The canvas may not even give you the little you need. Although it may not be much effort to make Canvas work for you. It depends on what you do, of course.

+3
source

(Measure and Arrange), , Grid's.

, Grid , , ( , dpi), .

+1

One thing to keep in mind is that the Grid will automatically adjust to fit its contents, while the Canvas will not. It matters when a Canvas or Grid is inserted inside some other panel. Especially if the panel size can change (for example, display a list with a variable size), it may be easier to use a Grid or StackPanel.

+1
source

All Articles