Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Items View cannot be used due to outdated CommunityToolkit nuget packages #402

Closed
3 of 24 tasks
D-Naveenz opened this issue Apr 18, 2024 · 3 comments
Closed
3 of 24 tasks

Comments

@D-Naveenz
Copy link

Describe the bug

UI controls that inherit Items Repeater, such as Items View, cannot be used in a project. It produces an error,
Failed to assign to property 'Microsoft.UI.Xaml.Controls.ItemsRepeater.ItemTransitionProvider'

My project is using the latest packages.

  • WinAppSDK 1.5
  • Dot Net 8.0

There is a detailed discussion ongoing here: microsoft/microsoft-ui-xaml#8810
According to the information,
"Calling out here that CommunityToolkit.WinUI.UI.Controls is the old package from 7.x built against WASDK 1.0"

So, the main problem comes with the XamlMetaDataProviders loading order.
But that's not the only problem; CommunityToolkit.WinUI.UI packages are heavily outdated and isn't compatible with the Windows Community Toolkit Gallery App.
Ex: SettingsCard control is not there.

Steps to reproduce

1) Make a WinUI 3 Application using Template Studio (easier way)
2) Add an ItemsView control in a page
3) Try to run the application

Expected behavior

  1. Correctly generate code from XAML scripts.
  2. Compatible with the Windows Community Toolkit Gallery App

Screenshots

No response

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

No response

Device form factor

Desktop

Additional context

There is a temporary solution.

In your app's csproj file add this property to the first PropertyGroup:
<XamlCodeGenerationControlFlags>DoNotGenerateOtherProviders</XamlCodeGenerationControlFlags>

This will cause the Xaml Compiler to not populate the OtherProviders list. You now need to populate it manually. In your App's constructor, call AddOtherProvider to add each of the IXamlMetadataProviders that were previously being generated. Since you can now control the order you can make sure that XamlControlsXamlMetaDataProvider comes first:

var xmpList = new MetadataProviders().GetAll();
foreach (var xmp in xmpList)
{
_AddOtherProvider(xmp);
}

metadataProviders.Add(new Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_Core_XamlTypeInfo.XamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_DataGrid_XamlTypeInfo.XamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_Input_XamlTypeInfo.XamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_Layout_XamlTypeInfo.XamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_Markdown_XamlTypeInfo.XamlMetaDataProvider());
metadataProviders.Add(new CommunityToolkit.WinUI.UI.Controls.CommunityToolkit_WinUI_UI_Controls_Media_XamlTypeInfo.XamlMetaDataProvider());

Help us help you

Yes, but only if others can assist.

@michael-hawker
Copy link
Member

Duplicate of #234. The issue you linked to in the WinUI repo is tracking this issue with the SDK. We've been discussing this issue with them as every WASDK release which introduces a new component has been hitting this issue.

All the 7.x packages are old, for instance CommunityToolkit.WinUI.UI.Controls.Primitives is now just CommunityToolkit.WinUI.Controls.Primitives, see the 8.0 release blog with more info

For now, the latest 8.1-rc build on NuGet resolves this issue by targeting the latest WASDK version, we hope to ship the full release soon.

@michael-hawker michael-hawker closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@D-Naveenz
Copy link
Author

Is there a way to get the 8.1-rc NuGet package, or can I build it by cloning the project?

@michael-hawker
Copy link
Member

@D-Naveenz it's on NuGet... just ensure you've checked 'include pre-release' in Visual Studio. (https://github.com/CommunityToolkit/Windows/wiki/Preview-Packages#preview-packages-on-nuget)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants