CommunityToolkit / CommunityToolkit/Windows

GridSplitter Style loading issue when used in code-behind only

Open
#273 11 comments 2 reactions 1 assignee Claimed by @Arlodotexe View on GitHub
bug components::controls::sizers help wanted
Dominant language
C#
Stars
1.1k
Forks
166
PR merge metrics
No merged PRs in 30d

Description

### 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

```text
(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)
























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](https://github.com/CommunityToolkit/Windows/assets/45748083/fd361fb8-5752-490e-970b-cae842a76cc2)
(2) GridSplitter (CommunityToolkit.WinUI.UI.Controls.Layout)
https://github.com/CommunityToolkit/Windows/assets/45748083/dbfca4ff-7194-4eb2-ac2d-0b7c32724066

### Code Platform

- [ ] UWP
- [X] 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)
- [X] 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)
- [X] 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.