-
Notifications
You must be signed in to change notification settings - Fork 54
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
More Sample Option Attributes #336
Conversation
@niels9001 added link to #207 at top of your description. FYI @Arlodotexe as well. I believe the optional I feel like we maybe want to be more consistent here? Or should we just get rid of Thoughts? |
...n/CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleTextOptionAttribute.cs
Show resolved
Hide resolved
@michael-hawker Custom titles should be optional (for complex or multi-control samples), though we could use the bound variable name as the default. |
@Arlodotexe what do you mean? What would a 'multi-control' sample be? Like where would we need to customize this. I think it's clearer if we have the text matching the property they're going to see bound in the XAML example code, right? Otherwise if you're looking at the sample code you don't know what the toggle/slider/etc... is manipulating. |
What I mean is that there will be (currently are, in the case of Rive) cases where a label might not be needed or where a custom description provides more value than using the variable name. We shouldn't lock ourselves out of having the option. Using the |
...CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleSliderOptionAttribute.cs
Outdated
Show resolved
Hide resolved
...CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleSliderOptionAttribute.cs
Outdated
Show resolved
Hide resolved
...CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleSliderOptionAttribute.cs
Outdated
Show resolved
Hide resolved
...CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleSliderOptionAttribute.cs
Outdated
Show resolved
Hide resolved
...CommunityToolkit.Labs.Core.SourceGenerators/Attributes/ToolkitSampleSliderOptionAttribute.cs
Outdated
Show resolved
Hide resolved
…ToolkitSampleSliderOptionAttribute.cs
…ToolkitSampleSliderOptionAttribute.cs
…ToolkitSampleSliderOptionAttribute.cs
…ToolkitSampleSliderOptionAttribute.cs
…unityToolkit/Labs-Windows into user/niels9001/more-options
...unityToolkit.Labs.Core.SourceGenerators/Metadata/ToolkitSampleTextOptionMetadataViewModel.cs
Outdated
Show resolved
Hide resolved
…olkitSampleTextOptionMetadataViewModel.cs
@Arlodotexe CI complains about 'Arguments missing'.. but I can't figure out where that'd be.. Do you see if I am missing something obvious :)? |
Fixed! Thanks for the help. @michael-hawker Added a bool to switch between NumberBox / Slider as well - see original post. Once this passes CI, this should be ready to review :)! |
One thing that's not working: the titles do not show up. |
@niels9001 the build is failing on the tests that check/look that these attributes are parsed/working as expected, so you'll need to update/add to those as well. As for the Title not displaying, @Arlodotexe thoughts? |
common/CommunityToolkit.Labs.Shared/Renderers/GeneratedSampleOptionsRenderer.xaml
Show resolved
Hide resolved
Have a fix incoming for the issue with Title not appearing. Since we switched to using the property on the Attribute, this wasn't setup when we rehydrated the attributes to store for creating the sample registry, thus the Title was blank and not propagated to the UI. We needed an extra step to grab the property value on the attribute in the source generator when it ran so that we could add it back into the attribute we use for storage to generate the registry from. This would then let it flow up back the rest of the chain to the UI and display properly once fixed. Had to also add in some extra helper to the tests for checking the generated source (we can probably do more to clean this up later), would be nice to compile the source or get the compiled instance of the source to check actual values via code vs. comparing strings. Would make it easier to call out specific things missing too vs. having to check manually if a test fails. Generator tests are passing for me locally: So, we'll have to see what happens in CI now. |
…erly from construction of attribute in source generator
…els9001/more-options More Sample Option Attributes
Related to #207
This PR introduces the following changes:
How to test: