CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.88k stars 1.38k forks source link

Samples use custom theme resources #4312

Open michael-hawker opened 3 years ago

michael-hawker commented 3 years ago

Describe the bug

Some of our samples (like ListDetailsView) use custom theme resources {ThemeResource Brush-Blue-01} which cause problems if copied blindly. Any resources defined or used should be part of the sample XAML or we should only use system level resources that are part of OS/WinUI 2.x.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Copy ListDetailsView sample XAML into a new app...
  2. Run, get an exception in MeasureOverride because theme resource is missing

Expected behavior

Easy to copy example and make work in an app.

Environment

NuGet Package(s):

Package Version(s):

Windows 10 Build Number:

App min and target version:

Device form factor:

Visual Studio version:

Additional context

This is something probably for us to keep in mind as we re-work samples in the future.

ghost commented 3 years ago

Hello michael-hawker, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

Arlodotexe commented 2 years ago

@michael-hawker What do you think is a good solution to this? Copy each brush definition into the sample, hardcoding a neutral color that works under both themes, or trying to switch to some platform-defined brush?

michael-hawker commented 2 years ago

@Arlodotexe I think sticking as much to possible to system defined brushes would be great as then even copying a snippet of a sample would work. Worst-case if we need a custom resource, we should probably copy them into each sample as needed from whatever design structure/guidance we have setup, if it's a common thing/color.

We'll need a list of these little details for things to keep track of for new samples in the Labs repo too. 🙂