Skip to content

GridSplitter with '1*'-<sized>-<sized> columns does not resize as expected #339

@abdes

Description

@abdes

Describe the bug

"CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.240109"

Consider a grid with 3 columns and 2 splitters as following:

    <Grid
        VerticalAlignment="Stretch"
        BorderBrush="{ThemeResource SystemControlHighlightChromeHighBrush}"
        BorderThickness="0,0,1,1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300*" MinWidth="100" />
            <ColumnDefinition Width="Auto" MinWidth="6" />
            <ColumnDefinition Width="300" MinWidth="32" />
            <ColumnDefinition Width="Auto" MinWidth="6" />
            <ColumnDefinition Width="300" MinWidth="32" />
        </Grid.ColumnDefinitions>

        <Border
            Grid.Row="0"
            Grid.Column="0"
            Background="MidnightBlue">
            <TextBlock Text="This text is in a column with 1* Width - This is what causes the second splitter not to work." TextWrapping="Wrap" />
        </Border>
        <Border Grid.Row="0" Grid.Column="2">
            <TextBlock Text="This column resizes properly, and if it's the only one after the 1* column, it also resizes properly." TextWrapping="Wrap" />
        </Border>
        <Border
            Grid.Row="0"
            Grid.Column="4"
            Background="DarkRed">
            <TextBlock Text="This text Is not resizing - Grid.Column.Width = 300 - ResizeBehavior=PreviousAndNext" TextWrapping="Wrap" />
        </Border>

        <!--  Column Grid Splitter  -->
        <controls:GridSplitter
            Grid.Column="1"
            Width="16"
            ResizeBehavior="PreviousAndNext"
            ResizeDirection="Auto" />

        <!--  Row Grid Splitter  -->
        <controls:GridSplitter
            Grid.Column="3"
            Width="16"
            ResizeBehavior="PreviousAndNext"
            ResizeDirection="Auto" />
    </Grid>

Splitter at Column 1 works fine, but splitter at Column 3 does not resize Column 4 as expected.

Steps to reproduce

Run the attached sample.

GridSplitterBug.zip

Expected behavior

Given that the splitter is configured to resize PreviousAndNext, it is supposed to resize both columns.

Screenshots

GridSplitter.Bug.2024-02-19.222346.mp4

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

Any version of windows

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

latest

Device form factor

Desktop

Additional context

<ItemGroup>
	<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.240109" />
	<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" />
	<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
</ItemGroup>

Help us help you

Yes, I'd like to be assigned to work on this item.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions