CommunityToolkit / CommunityToolkit/Windows

Segmented Control in WPF XAML ISLAND, XAML parsing failed.

Aperta
#744 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
1.1k
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Describe the bug

Hello,

When I add
```xmlns:controls="using:CommunityToolkit.WinUI.Controls"```
And
```



```
To StackPanel, the Window does not initialize anymore with cryptic error: XAML parsing failed.

Image

I think the issue is how I initialize resources:
```
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
XamlControlsXamlMetaDataProvider.Initialize();
xamlMetaDataProvider = new();
this.Resources.MergedDictionaries.Add(new Microsoft.UI.Xaml.Controls.XamlControlsResources());
//this.Resources.MergedDictionaries.Add(new Microsoft.UI.Xaml.ResourceDictionary() { Source = new Uri("ms-appx:///CommunityToolkit.WinUI.Controls.Segmented/Themes/Generic.xaml") });

}
```
If I uncomment my attempt to load Segmented, it fails on COM Exception.

### Steps to reproduce

https://github.com/castorix/WPF_XAML_Islands_WinUI3/tree/master

Clone this repo, update to newest WinUI SDK, add CommunityToolkit.WinUI.Segmented and add Segmented. Same issue.

### Expected behavior

Segmented loads?

### Screenshots

_No response_

### 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)
- [x] 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

_No response_

### Visual Studio Build Number

2026 Version: 18.0.0

### Device form factor

Desktop

### Additional context

It is WPF XAML ISLANDS.

### Help us help you

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Clone the linked WPF_XAML_Islands_WinUI3 reproduction and start with OnLaunched, the Segmented XAML element, and the resource initialization shown in the issue. Compare behavior with and without the Segmented resource dictionary and confirm what causes the XAML parsing or COM exception. Done means Segmented loads in the stated WPF XAML Islands setup without preventing Window initialization.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
desktop
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.