-
Notifications
You must be signed in to change notification settings - Fork 73
Added improved default control and style examples to ProjectTemplate #167
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
Conversation
CI failing:
But agree some of this may be resolved by #154, which hopefully we can get in soon. |
template/lab/samples/ProjectTemplate.Sample/ProjectTemplateFirstSamplePage.xaml
Outdated
Show resolved
Hide resolved
template/lab/tests/ProjectTemplate.Tests/ExampleProjectTemplatePage.xaml.cs
Outdated
Show resolved
Hide resolved
@Arlodotexe plan is to rebase this next right? You going to add the example template binding and have the two different controls, eh? Maybe we merge it then at that point so Matt can start looking at the template generation option split and we can follow-up with example test cases afterwards? |
I've uncovered an issue with the source generators. Investigating... |
…thin the same assembly broken the generator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Arlodotexe so with both styles the TemplatedControl.cs
backing code is effectively the same, though with the TemplatedControlStyle.xaml/cs
backed file it doesn't use the OnApplyTemplate
method right?
So effectively, we want to have a switch between:
- .NET Standard w/ no control in source/sample/tests
- [default] Templated Control with traditional Style/OnApplyTemplate (TemplateControlSample pages)
- Templated Control with backed resource dictionary file (BackedTemplateControlSamples)
@mrlacey any comments on this PR about things that would make this work better for the template engine for the above?
common/CommunityToolkit.Labs.Core.SourceGenerators/ToolkitSampleOptionGenerator.cs
Outdated
Show resolved
Hide resolved
template/lab/samples/ProjectTemplate.Sample/BackedTemplatedControlSample.xaml
Outdated
Show resolved
Hide resolved
template/lab/tests/ProjectTemplate.Tests/ExampleProjectTemplatePage.xaml.cs
Outdated
Show resolved
Hide resolved
template/lab/tests/ProjectTemplate.Tests/ExampleProjectTemplateTestClass.cs
Outdated
Show resolved
Hide resolved
@michael-hawker I would add on that the user should have the option to include both backed and non-backed resource dictionary, rather than having to pick one or the other. |
As separate controls? Why would you have them both for a single control? It's odd we'd have independent styles for one control? |
Not as separate controls, just as different styles.
They would pick/copy whichever one is needed for their scenario, for each control they need to make. It actually feels odd that we would exclude one or the other entirely. It's entirely plausible that someone might want/need to swap between x:Bind and TemplateBinding for different parts of their library control. Only including one out of the box means they'd need to copy from the project template just to get the other. |
template/lab/src/CommunityToolkit.Labs.WinUI.ProjectTemplate.csproj
Outdated
Show resolved
Hide resolved
template/lab/tests/ProjectTemplate.Tests/ExampleProjectTemplateTestClass.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few small name changes to help ensure everything is independent across experiments.
template/lab/samples/ProjectTemplate.Sample/BackedTemplatedControlSample.xaml.cs
Outdated
Show resolved
Hide resolved
template/lab/samples/ProjectTemplate.Sample/TemplatedControlSample.xaml.cs
Outdated
Show resolved
Hide resolved
template/lab/tests/ProjectTemplate.Tests/ExampleProjectTemplatePage.xaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, one thing I just thought of is having more details in the markdown to explain the different methodologies of the control templates, but that's just a wiki thing too. Looks good! Just need to wait on CI, but think that'll be good too. Thanks!
…/default-project-controls Added improved default control and style examples to ProjectTemplate
This PR adds code to the ProjectTemplate demonstrating:
OnApplyTemplate
{Binding}
and the newer{x:Bind}
Additional unit tests will be added as part of #160.
Closes #157