question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grid Star-Sizing does not work inside ListView

See original GitHub issue

Describe the bug

When Star-Sizing is used inside of a Grid which is a child of ListView, the columns have no sizing and fill their minimum amount of space Steps to reproduce the bug

Steps to reproduce the behavior:

class Counter {
	string Name {
		get; set;
	}
	
	int Count {
		get; set;
	}
}
<ListView
        x:Name="itemsList"
        HorizontalContentAlignment="Stretch">
        <ListView.ItemTemplate>
            <DataTemplate>
                
                <Grid x:Name="itemGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="4*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="1*"/>
                   
                    </Grid.ColumnDefinitions>


                    <TextBlock Text="{Binding Name}" Grid.Column="0"/>
                    <Button Content="+" Grid.Column="1"/>
                    <TextBlock Text="{Binding Count}" Grid.Column="2"/>
                    <Button Content="-" Grid.Column="3" />

                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

Set the ListView.itemSource in code.

Expected behavior

Name is 4x larger than the buttons, which are half the size of the number Screenshots

Version Info

Microsoft.WinUI 3.0.0-preview3.201113.0 Microsoft.NETCore.UniversalWindowsPlatform 6.2.10 NuGet package version:

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
20H2 (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Felix-Devcommented, Dec 1, 2020

@StephenLPeters Such a request was already made in the past (see the now closed issue https://github.com/microsoft/microsoft-ui-xaml/issues/1402) and back then @anawishnoff was not yet convinced of such a change. I suggest we re-open that issue if the team is open to discuss this again.

0reactions
robloocommented, Dec 1, 2020

I’m fine with re-purposing this one or using the older, closed issue I didnt know about. Definitely think this needs to be rediscussed. If it really is different from WPF its something obvious to change to make everyone’s job easier moving to WinUI 3. Personally, I will then cleanup some xaml removing the customized styling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does star sizing in a nested grid not work?
It doesn't cause more minimum space to be requested, it affects distribution of space in excess of the minimum.
Read more >
Exam Ref 70-484 Essentials of Developing Windows Store Apps ...
Correct: The ListView control is suitable for laying out items vertically in the screen. d. Correct: The Grid control can be set up...
Read more >
Microsoft Visual Studio 2015 Unleashed - Google Books Result
As specified in our prototype, our goal is to provide a single-page experience with the Windows project; we won't need a details page—just...
Read more >
List view and grid view - Windows apps
Use ListView and GridView controls to display and manipulate sets of data, such as a gallery of images or a set of email...
Read more >
SharedSizeGroup - 2000 Things You Should Know About WPF
You can use the SharedSizeGroup attribute to share column sizes across different grids. You can't normally share sizes of star-sized columns ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found