There are several ways to do what you are trying to do here. If performance is not a problem, I would ignore virtualization and try DockPanel . The disadvantage here is that you will need to add elements to and not add them line by line.
Another option is to use two stack panels (one in each direction). This relates to the issue of adding, but requires the use of more panels.
Both of the two previous parameters require the individual elements to set their height / width.
The final option (depending on how big your grid is) will use a grid with fixed sizes of rows and columns with elements that occupy rows (using rowspan ). The disadvantage of this method is that I donβt know what a good way to create this control in xaml for unspecified row / column numbers, so you will need to create it in your code to get the required number of rows / columns.
If you have performance issues, you can try using VirtualizingStackPanel . If this still does not meet your performance requirements, you need to subclass VirtualizingPanel and configure it to meet your specific needs.
Read more about panel performance here .
I suggest trying two StackPanel methods StackPanel , then VirtualizingStackPanel method, and finally, if that doesn't work, try VirtualizingPanel
Filling is easily accomplished by setting the Margin property on each subcontroller.
Use ScrollViewer to scroll ScrollViewer
mydogisbox
source share