Replies: 4 comments 1 reply
-
You can actually use multiple different data templates. Avalonia will work out which one to use based on the item type (meaning each of your View Models would need a different template). You can also use things like the template selector pattern if you need more advanced selection logic.
Probably. It may also look weird since the items will likely not all be the same size, which means each grid will have non uniform layouts in respect to each other. You could instead use a regular grid with shared scope sizing. WPF docs for that here https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/how-to-share-sizing-properties-between-grids?view=netframeworkdesktop-4.8 You could also change the item panel itself. But I suspect it wont do what you want. |
Beta Was this translation helpful? Give feedback.
-
thanks for the reply but maybe i wasn't clear, the data template only accepts one child which means each item and its label must be wrapped in a container of some sort which would be rendered as a single cell rather than 2 cells in a single row |
Beta Was this translation helpful? Give feedback.
-
Uniform grid will take the size of the first cell as the size for all cells in the grid. |
Beta Was this translation helpful? Give feedback.
-
thanks the issue isn't multiple datatemplates the multiple children (cells) per one template -will have to look into the suggested custom template types |
Beta Was this translation helpful? Give feedback.
-
i am trying to create a formlike layout consisting of an a list of items displayed as label in 1st column value in 2nd column
using an itemscontrol bound to the array with itemcontrolpaneltemplate set to a 2 column uniformgrid
we can only supply a single item in the itemscontrol.itemtemplate/datatemplate is it possible to use uniformgrid for this?
what is the alternative ? nested stack panels with defined item widths ? seems very cumbersome and not very flexible
Beta Was this translation helpful? Give feedback.
All reactions