Added a Scratch Pad page where sample xaml can be loaded - #1548
Merged
Merged
Conversation
Scott Jones (Scottj1s)
approved these changes
May 21, 2024
Contributor
Author
|
/azp run |
Contributor
Author
|
/azp run |
Collaborator
|
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. |
Karen (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):

## 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.
This file contains hidden or 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
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.