-
Notifications
You must be signed in to change notification settings - Fork 619
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
Added a Scratch Pad page where sample xaml can be loaded #1548
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scottj1s
reviewed
May 21, 2024
Scottj1s
reviewed
May 21, 2024
Scottj1s
reviewed
May 21, 2024
Scottj1s
reviewed
May 21, 2024
Scottj1s
reviewed
May 21, 2024
Scottj1s
reviewed
May 21, 2024
Scottj1s
approved these changes
May 21, 2024
/azp run |
/azp run |
Thanks for this PR, I'm very excited for this! We can create a separate NavView Item and put this page under "Tools". This can be in the next PR. |
karkarl
pushed a commit
that referenced
this pull request
Jul 15, 2024
## Description Added a “Scratch Pad” page to the gallery where the user can type in some XAML markup and click the Load button to immediately see the results. This provides a convenient place for experimentation. It can also be used to provide a simple repro for issues which only require loading the right XAML markup. This change currently adds the “Scratch Pad” page to the “System” group in the navigation pane. This seems like the best fit currently, without a “Tools” section or something else. ## Details about the Scratch Pad * There is syntax coloring for the XAML in the RichEditBox on the page. The syntax coloring only updates on Load. * The user can press F5 when focus is in the RichEditBox to trigger a Load. * The XAML markup is stored in application data on Load. This stored XAML is loaded the next time the user returns to Scratch Pad, even on a fresh launch of WinUI 3 Gallery. * There is some basic auto-indenting, auto close-tag insertion, and auto property-quotes insertion handling. ## Known issues/limitations * Syntax coloring only updates on Load. * The undo stack of the RichEditBox contains an extra undo every time the syntax coloring is applied. (This is the main reason it isn’t applied every time the text changes.) * `{x:Bind}` is not supported and will cause a load error. A possible future improvement would be to strip out any such properties to load as much as possible. * Events (like Button.Click event) appear to not cause errors, but don’t get connected to anything. * If either the content or the xaml markup textbox get too tall, they expand to take as much space as needed. It would be nicer for individual ScrollViewers to scroll when needed, which would require overriding the standard ScrollViewr on ItemsPage.xml. ## How Has This Been Tested? Tested loading a variety of markup. Tested its ability to save and load small and large markup to app data. Tested the "Toggle Theme" button to ensure it behaves well. Tested with Accessibility Insights to ensure there weren't any issues. ## Screenshots (if appropriate): ![image](https://github.com/microsoft/WinUI-Gallery/assets/45052236/35e28cba-9476-4272-87c9-acd056c6377d) ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Some possible future improvements * Maybe support choosing from multiple default samples to load. * Maybe support saving and loading multiple user-named samples. * Maybe add a way for every control sample in the app to be able to navigate to Scratch Pad with the content of that sample.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added a “Scratch Pad” page to the gallery where the user can type in some XAML markup and click the Load button to immediately see the results. This provides a convenient place for experimentation. It can also be used to provide a simple repro for issues which only require loading the right XAML markup.
This change currently adds the “Scratch Pad” page to the “System” group in the navigation pane. This seems like the best fit currently, without a “Tools” section or something else.
Details about the Scratch Pad
Known issues/limitations
{x:Bind}
is not supported and will cause a load error. A possible future improvement would be to strip out any such properties to load as much as possible.How Has This Been Tested?
Tested loading a variety of markup. Tested its ability to save and load small and large markup to app data. Tested the "Toggle Theme" button to ensure it behaves well. Tested with Accessibility Insights to ensure there weren't any issues.
Screenshots (if appropriate):
Types of changes
Some possible future improvements
Bonus fix
Removed an unused variable in IconsPage.xaml.cs to remove a compiler warning.