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.

Not working shared size scope, Shared size scrope is converting * to Auto

See original GitHub issue

Tried to make a list of tasks running in background which has a style similar to what MenuItem has, but found that shared size doesn’t work at all, but applies when and only when it is reset. Here’s a gif showing how it behaves:

shared_size

To make a minimal repro use the following XAML (cut off of the original):

<ScrollViewer>
  <ItemsRepeater
    x:Name="AllOperations"
    Grid.IsSharedSizeScope="True"
    Items="{Binding Operations}"
    KeyboardNavigation.TabNavigation="Continue">

    <ItemsRepeater.Layout>
      <StackLayout Orientation="Vertical" Spacing="8" />
    </ItemsRepeater.Layout>

    <ItemsRepeater.ItemTemplate>
      <DataTemplate DataType="status:Operation">
        <Button Height="{StaticResource StatusBarHeight}">

          <Grid>

            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" SharedSizeGroup="OperationName" />
              <ColumnDefinition Width="{StaticResource StatusBarIconWidth}" />
              <ColumnDefinition Width="{StaticResource StatusBarProgressWidth}" />
              <ColumnDefinition Width="{StaticResource StatusBarIconWidth}" />
            </Grid.ColumnDefinitions>

            <TextBlock
              Grid.Column="0"
              Grid.ColumnSpan="2"
              Margin="4,0"
              Text="{Binding Name}"
              TextTrimming="CharacterEllipsis" />

            <controls:ProgressBar
              Grid.Column="2"
              Margin="4,0"
              HorizontalAlignment="Stretch"
              Maximum="1"
              Value="{Binding Progress}" />

            <TextBlock
              Grid.Column="3"
              Margin="4,0"
              IsVisible="{Binding !#PART_OperationStatus.IsVisible}"
              Text="{Binding Progress, StringFormat=\{0:P0\}}"
              TextAlignment="Center" />

            <Border
              x:Name="PART_OperationStatus"
              Grid.Column="3" />

          </Grid>

        </Button>
      </DataTemplate>
    </ItemsRepeater.ItemTemplate>

  </ItemsRepeater>
</ScrollViewer>
private class Operation
{
    public string Name { get; set; }

    public double? Progress { get; set; }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wieslawsoltescommented, Aug 23, 2021

Shared size scrop is converting * to Auto

Same as in WPF https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.grid.issharedsizescope?view=net-5.0#remarks

Columns and rows participating in size sharing do not respect Star sizing. In this scenario, Star sizing is treated as Auto.

0reactions
timuniecommented, Oct 1, 2022

Try to not set SharedGridSizeGroup to a column with size *. Then it works for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF Grid SharedSizeGroup error
IsSharedSizeScope to True on parent element ( TabControl ) should stop size sharing propagation above the hierarchy. Like so:
Read more >
Grid.IsSharedSizeScope Attached Property
Grid size sharing does not work if IsSharedSizeScope is set to true within a resource template, and a SharedSizeGroup is defined outside of...
Read more >
WPF Two Grid Columns the Same Size
You can force two columns, or rows, in a WPF Grid Panel to be the same size. How do you do that? Use...
Read more >
How to: Share Sizing Properties Between Grids - WPF . ...
This example shows how to share the sizing data of columns and rows between Grid elements in order to keep sizing consistent.
Read more >
IsSharedSizeScope
We'd like them to autosize, but to use that same size across all rows, for each column. We can share sizes between entries...
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