Skip to content

GridSplitter Style loading issue when used in code-behind only #273

@zou-z

Description

@zou-z

Describe the bug

There are two GridSplitter for winui3 that we can use now. first come from CommunityToolkit.WinUI.Controls.Sizer NuGet package. this GridSplitter will throw an unhandled exception when i add it in cs code. the other GridSplitter come from CommunityToolkit.WinUI.UI.Controls.Layout. sometime i have to drag hard to make it work.

Steps to reproduce

(1) GridSplitter (CommunityToolkit.WinUI.Controls.Sizer) public class TestTest : UserControl { public TestTest() { var grid = new Grid(); Content = grid; grid.Children.Add(new GridSplitter()); } } add this user control to main page and start application.then it throw an unhandled exception. (2) GridSplitter (CommunityToolkit.WinUI.UI.Controls.Layout) <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.03125*"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="0.03125*"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="0.0625*"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="0.125*"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="0.25*"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="0.5*"/> </Grid.ColumnDefinitions> <Border Grid.Column="0" Background="Red"/> <controls:GridSplitter Grid.Column="1"/> <Border Grid.Column="2" Background="Green"/> <controls:GridSplitter Grid.Column="3"/> <Border Grid.Column="4" Background="Red"/> <controls:GridSplitter Grid.Column="5"/> <Border Grid.Column="6" Background="Green"/> <controls:GridSplitter Grid.Column="7"/> <Border Grid.Column="8" Background="Red"/> <controls:GridSplitter Grid.Column="9"/> <Border Grid.Column="10" Background="Green"/> </Grid> add several control and GridSplitter one by one. from last to first drag the GridSplitter.you will find the front GridSplitter is hard to drag. 

Expected behavior

  1. can add and remove in cs code.
  2. can drag normally.

Screenshots

(1) GridSplitter (CommunityToolkit.WinUI.Controls.Sizer)
image
(2) GridSplitter (CommunityToolkit.WinUI.UI.Controls.Layout)
https://github.com/CommunityToolkit/Windows/assets/45748083/dbfca4ff-7194-4eb2-ac2d-0b7c32724066

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

No response

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

17.7.5

Device form factor

Desktop

Additional context

CommunityToolkit.WinUI.Controls.Sizer 8.0.230907
CommunityToolkit.WinUI.UI.Controls.Layout 7.1.2
Microsoft.Windows.SDK.BuildTools 10.0.22621.756
Microsoft.WindowsAppSDK 1.4.230913002

Help us help you

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomponents::controls::sizersResize various parts of your UI easily in a consistent fashion.help wantedExtra attention is needed

Type

No type

Projects

Status

🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions