CommunityToolkit / Windows

Collection of controls for WinUI 2, WinUI 3, and Uno Platform developers. Simplifies and demonstrates common developer tasks building experiences for Windows with .NET.
https://aka.ms/windowstoolkitdocs
Other
571 stars 70 forks source link

CommunityTookit controls conflicts with WindowsAppSDK 1.5 control #365

Open efreykongcn opened 8 months ago

efreykongcn commented 8 months ago

Describe the bug

I have an WinUI project which using CommunityToolkit controls (SettingsControls etc.) After upgrade the WindowsAppSDK to 1.5, and using Selectorbar control in a new page, run app and visit the new page, the app throws Microsoft.UI.Xaml.Markup.XamlParseException with error message The text associated with this error code could not be found. Cannot find a Resource with the Name/Key.

If I remove the CommunityToolkit reference, the SelectorBar page can be displayed correctly.

Steps to reproduce

* Creates a new empty WinUI3 project by Visual Studio 2022

* Open Nuget Package Manager, installs CommunityToolkit.WinUI.Controls.SettingsControls, and Upgrades WindowsAppSDK to 1.5
* In `App.xaml`, add `XamlControlsResources`. 
* In `ManWindow.xaml`, add a new WindowsAppSDK control `SelectorBar`. 
* Runs the project, the app throws `XamlParseException` Exception.

Below is full content of App.xaml file:

<?xml version="1.0" encoding="utf-8"?>
<Application
    x:Class="CommunityToolkitBugReproduce.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CommunityToolkitBugReproduce">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Below is the full content of MainWindow.xaml file:

<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="CommunityToolkitBugReproduce.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <SelectorBar x:Name="SelectorBar2" >
            <SelectorBarItem x:Name="SelectorBarItemPage1" Text="Page1" IsSelected="True" />
            <SelectorBarItem x:Name="SelectorBarItemPage2" Text="Page2" />
            <SelectorBarItem x:Name="SelectorBarItemPage3" Text="Page3" />
        </SelectorBar>
        <Frame x:Name="ContentFrame" IsNavigationStackEnabled="False" />
    </Grid>
</Window>

Failed to assign to property 'Microsoft.UI.Xaml.Controls.ItemsRepeater.ItemTransitionProvider'. [Line: 0 Position: 0]



### Expected behavior

App should display the page with selectorbar control. 

### Screenshots
![Screenshot 2024-03-12 232902](https://github.com/CommunityToolkit/Windows/assets/45627994/9b2c8799-6b20-4a30-ad12-45a57042f15d)

### 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)
- [ ] Windows 10 22H2 (Build 19045)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [X] Windows 10, version 1809 (Build 17763)
- [X] Windows 10, version 1903 (Build 18362)
- [X] Windows 10, version 1909 (Build 18363)
- [X] Windows 10, version 2004 (Build 19041)
- [X] Windows 10, version 2104 (Build 20348)
- [X] 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 similar issue on Microsoft WinUI repo: https://github.com/microsoft/microsoft-ui-xaml/issues/8810.

### Help us help you

Yes, I'd like to be assigned to work on this item.
insomniachi commented 8 months ago

Exception says cannot find resource TabViewButtonBackground, don't know why SelectorBar needs TabViewButtonBackground. post full XAML for MainWindow

efreykongcn commented 8 months ago

I've updated the bug comment with full xaml file content for MainWnidow and App, and corrected the snapshot. @insomniachi

michael-hawker commented 7 months ago

@efreykongcn 8.0 wasn't built against 1.5, it's the same issue was you found in the WinUI repo.

If you look at our https://aka.ms/wct/wiki/previewpackages latest feed, they now build against 1.5 and should work.

Arlodotexe commented 7 months ago

Like @michael-hawker said. The preview packages for 8.1 should have what you need, let us know if they fix the issue for you @efreykongcn!

efreykongcn commented 7 months ago

I followed the Preview Packages instructions and updated communitytoolkit packages (SettingsControls and TokenizingTextBox) to 1.0.0 (published on 2/27/2024) , and then build and run the test app, it works as expected. So I think this release does fix the issue.

Screenshot 2024-04-07 104108

@michael-hawker @Arlodotexe

Arlodotexe commented 7 months ago

@efreykongcn Here's the issues I can see in your screenshot:

efreykongcn commented 7 months ago

@Arlodotexe Thanks for your reply, here's my notes:

Issue 1 NuGet Package Explorer is set to "Windows Community Toolkit Labs" -- This is just to filter the preview packages.

Issue 2, The URL for the "Windows Community Toolkit Labs" is set to the PullRequests feed, not the labs feed

-- I added the labs feed at the first time, but the labs feed doesn't provide any release of preview packages (Pls see the snapshot). I've tried all those 3 sources (Labs, latest, pull requests), only PullRequests feed provides new release of the packages, which published date is 2/27/2024, but version is 1.0.0.

Screenshot 2024-04-09 123059

michael-hawker commented 7 months ago

@efreykongcn see https://aka.ms/wct/wiki/previewpackages for more info, but sounds like you're looking for the MainLatest feed: https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json

That'll have the latest builds from our main branch. The Settings Controls were moved out of Labs a while ago before we shipped 8.0 even.

Though we recently shipped previews on NuGet itself in preparation for our 8.1 release (for that you need to check the 'include prerelease' checkbox next to the search box to see them).

@Arlodotexe maybe we should list the Latest feed first in the wiki? Can also call out the Nuget checkbox too. And also, maybe add details about the version numbers, breakdown of the date format and also how the build number corresponds to the action run number and such? (Similarly for the PR one we could break down the PR number that's included, and remove the Nerdbank info as we don't use that anymore.)

efreykongcn commented 7 months ago

@michael-hawker Thanks a lot. I just updated the package to 8.1.240328-rc from nuget.org source, it satisfied my requirements.