Question: Control with uniformly stretched children? #7430
Replies: 7 comments
-
@tristanlabelle can you share the XAML you're using? If this isn't what you're trying to do a visual of the layout you're trying to achieve would help. If you don't need the virtualization, and |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply @michael-hawker , and pardon me for not being as responsive -- I missed the notification. Here's a repro (not quite minimal, there are other things going on higher in the tree). Given that the green <Border Grid.Column="1" BorderThickness="1" BorderBrush="Green">
<ItemsRepeater HorizontalAlignment="Stretch" Background="Blue" ItemsSource="{Binding Measures}">
<ItemsRepeater.Layout>
<UniformGridLayout Orientation="Horizontal" ItemsStretch="Uniform" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" MinWidth="50" MinHeight="20" BorderBrush="Red" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</Border> |
Beta Was this translation helpful? Give feedback.
-
Hmm, I see the blue background with the older WinUI 2.4.2... For the border size, I imagine since they don't have any size, they're reporting their min size and then UniformGridLayout is trying to make them all the same size... but it is a bit odd that none of the settings change that behavior... |
Beta Was this translation helpful? Give feedback.
-
@michael-hawker Should I file bugs for the background color and uniform stretching both? |
Beta Was this translation helpful? Give feedback.
-
@tristanlabelle probably makes sense to have a separate bug for the background if that's not working on the latest. For the stretching, I'd leave this question here for the WinUI team to respond to for now. |
Beta Was this translation helpful? Give feedback.
-
@tristanlabelle I think the behavior you are describing is a standard GridView, no? @ranjeshj FYI about the repeater layout issues. @chingucoding might have thoughts too. |
Beta Was this translation helpful? Give feedback.
-
@tristanlabelle The behavior of the items only being on the left can be changed with the Regarding ItemsRepeater not having a background I'm suprised it even exists since the control doesn't even have a template, maybe @ranjeshj knows more about this? Also, GridView should also be suitable here as @StephenLPeters pointed out correctly. |
Beta Was this translation helpful? Give feedback.
-
New user of WinUI 3.0 here. I'm trying to layout items from an
ItemsSource
in a single row such that each item gets allocated a width corresponding to the width of the parent control divided by the number of children. The closest I found is having an<ItemsRepeater>
with a<UniformGridLayout>
, but I can't find a combination ofItemsJustification
andItemsStretch
that will stretch the children rather than padding with blank space.<UniformGrid>
from the CommunityToolkit won't work because I can't data-bind anItemsSource
. I thought of subclassingLayout
but I can't find documentation on the WinRT goop required for that from C#. Any ideas?Beta Was this translation helpful? Give feedback.
All reactions