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

TokenView uses Brush from Sample App #424

Closed
michael-hawker opened this issue Apr 17, 2023 Discussed in #421 · 3 comments · Fixed by #423
Closed

TokenView uses Brush from Sample App #424

michael-hawker opened this issue Apr 17, 2023 Discussed in #421 · 3 comments · Fixed by #423
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions) issue 🧪 Used for tracking an Issue/Bug/Feature of an open Experiment/Component

Comments

@michael-hawker
Copy link
Member

Discussed in #421

Originally posted by WillyWoe April 15, 2023
My csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>LabsTests</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64;arm64</Platforms>
    <RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
    <PublishProfile>win10-$(Platform).pubxml</PublishProfile>
    <UseWinUI>true</UseWinUI>
    <EnableMsixTooling>true</EnableMsixTooling>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Assets\SplashScreen.scale-200.png" />
    <Content Include="Assets\LockScreenLogo.scale-200.png" />
    <Content Include="Assets\Square150x150Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
    <Content Include="Assets\StoreLogo.png" />
    <Content Include="Assets\Wide310x150Logo.scale-200.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="CommunityToolkit.Labs.WinUI.TokenView" Version="0.0.4" />
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230118.102" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" />
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>

  <!-- 
    Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
    Tools extension to be activated for this project even if the Windows App SDK Nuget
    package has not yet been restored.
  -->
  <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <ProjectCapability Include="Msix" />
  </ItemGroup>

  <!-- 
    Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution 
    Explorer "Package and Publish" context menu entry to be enabled for this project even if 
    the Windows App SDK Nuget package has not yet been restored.
  -->
  <PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
  </PropertyGroup>
</Project>

My xaml:

<Window
    x:Class="LabsTests.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:LabsTests"
    xmlns:labs="using:CommunityToolkit.Labs.WinUI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Grid>
        <labs:TokenView AllowDrop="True"
                        CanReorderItems="True"
                        IsWrapped="True"
                        SelectedIndex="2"
                        SelectionMode="Single">
            <labs:TokenItem Content="All" />

            <labs:TokenItem Content="Apps">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xECAA;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Work">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE821;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Documents">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE8A5;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Web">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE12B;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Settings">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE115;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="People">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE13D;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Folders">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE8B7;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
            <labs:TokenItem Content="Photos">
                <labs:TokenItem.Icon>
                    <FontIcon Glyph="&#xE91B;" />
                </labs:TokenItem.Icon>
            </labs:TokenItem>
        </labs:TokenView>
    </Grid>
</Window>

and this is the exception:

Error HRESULT E_FAIL has been returned from a call to a COM component.
at WinRT.ExceptionHelpers.g__Throw|20_0(Int32 hr)
at CommunityToolkit.WinUI.UI.Controls.WrapPanel.MeasureOverride(Size availableSize)
at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.g__Throw|20_0(Int32 hr)
at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)

What am I doing wrong?

@michael-hawker michael-hawker added experiment 🧪 Used to track issues that are experiments (or their linked discussions) issue 🧪 Used for tracking an Issue/Bug/Feature of an open Experiment/Component labels Apr 17, 2023
@michael-hawker
Copy link
Member Author

@WillyWoe new package 0.0.5 should hopefully be pushed up to NuGet in the next hour or so, let us know if that resolves your issue. Will leave this open until we get confirmation. Thanks!

@WillyWoe
Copy link

It works!, thank you!!

@michael-hawker
Copy link
Member Author

Thanks for reporting and validating @WillyWoe! Let us know what you build! 🦙❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions) issue 🧪 Used for tracking an Issue/Bug/Feature of an open Experiment/Component
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants