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

Sample options and viewable source #29

Merged
merged 29 commits into from
Mar 8, 2022

Conversation

Arlodotexe
Copy link
Member

This PR makes progress towards a more cohesive sample system by adding the infrastructure for sample options and viewing source code.

Overview:

  • Adds XamlNamedPropertyRelay to enable accessing XAML declared x:Name properties from outside of a control.
    • This will help create more advanced option panes without cluttering up the code-behind shown to the user.
    • Added under a new project CommunityToolkit.Labs.Core.SourceGenerators.XamlNamedPropertyRelay. Separate as not all projects need this generator.
    • Example can be found in the second placeholder sample.
  • Adds generated sample options which automatically generates properties to bind to and a sample page to control them.
    • Supports boolean and multiple choice
    • Example can be found in the first placeholder sample.
  • Renames CommunityToolkit.Labs.Core to CommunityToolkit.Labs.Core.SourceGenerators, since it only contains generators and models that use them.
  • Includes and displays source code for each sample. Assumes namespace matches folder structure.
  • Auto-strips source generator attributes from the final compiled code. Prevents them from showing to the user as code-behind for the sample control.
  • Adds source generator diagnostics for usage of attributes that belong to the Labs sample system.
  • Adds unit tests for CommunityToolkit.Labs.Core.SourceGenerators, to ensure diagnostics are outputted correctly.

Demo:

Recordedvideo2022-02-07-191730-1.mp4

…ed basic unit tests. Misc fixes and improvements.
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't dug into the sample display and the markdown renderer stuff yet, but had some initial feedback on the attribute syntax/usage and stuff from the source generator side. Let me know your thoughts and if we can simplify any of those things or not. Also is this just working on UWP or also on WinUI 3/WASM?

@Arlodotexe
Copy link
Member Author

Also is this just working on UWP or also on WinUI 3/WASM?

This should be working on all 3 heads.

@michael-hawker
Copy link
Member

@Arlodotexe looking good! Had to clean my local environment to get the WASM head to run.

Only thing is that the XAML/C# display wasn't working there:

image

I didn't notice any obvious errors or exceptions outputted...

UWP and WinUI 3 heads worked great though!

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just need to understand the WASM C#/XAML display issue, and we'll be good! 🎉🚀

@Arlodotexe
Copy link
Member Author

For the inconsistent behavior between UWP/WASDK and Uno, I've filed an issue here: unoplatform/uno#8266

@Arlodotexe Arlodotexe merged commit 63001ee into main Mar 8, 2022
@delete-merged-branch delete-merged-branch bot deleted the feature/options-and-viewable-source branch March 8, 2022 17:20
Martin1994 pushed a commit to Martin1994/Labs-Windows that referenced this pull request Sep 2, 2023
…options-and-viewable-source

Sample options and viewable source
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

Successfully merging this pull request may close these issues.

None yet

2 participants