Not working shared size scope, Shared size scrope is converting * to Auto
See original GitHub issueTried 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:
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:
- Created 2 years ago
- Comments:9 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Shared size scrop is converting
*
toAuto
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.
Try to not set SharedGridSizeGroup to a column with size *. Then it works for me.