Skip to content

Fixes #3673 and resolves issues with some samples not working correctly #3675

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

Merged

Conversation

michael-hawker
Copy link
Member

Fixes #3673

Forgot to check some scenarios in the original update to #3648 and broke scenarios of pages with code-behind. This PR resolves that and forward-fixes all sample types (XAML only, code-behind, code-behind + XamlRoot).

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Refactoring (no functional changes, no api changes)

What is the current behavior?

If a sample page didn't have a XamlRoot defined in it's page it was getting obliterated in the UpdateXamlRender call.

What is the new behavior?

Clearly defined what a SamplePage was (to be the backing instance of a sample (if one)). Then used that to instead overwrite it's content as intended if there is no XamlRoot instead of the entire page itself.

i.e. the bug was that we were replacing the entire page with the rendered XAML and therefore no longer held an instance to call IXamlRenderListener on. This fix now checks for that condition and only updates the inner page content vs. our entire hosted content within the Sample.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

FYI @RosarioPulella, @Kyaa-dost

@ghost
Copy link

ghost commented Jan 19, 2021

Thanks michael-hawker for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from azchohfi and Kyaa-dost January 19, 2021 20:29
@ghost ghost requested a review from Rosuavio January 19, 2021 20:29
@michael-hawker michael-hawker added this to the 7.0 milestone Jan 19, 2021
@ghost ghost added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jan 19, 2021
@michael-hawker
Copy link
Member Author

michael-hawker commented Jan 19, 2021

Once we validate and merge this to the main branch we can update the dev branches as well. FYI @Sergio0694

Copy link
Contributor

@Rosuavio Rosuavio left a comment

Choose a reason for hiding this comment

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

Seems to have fixed things to me,

@michael-hawker
Copy link
Member Author

@Kyaa-dost want to test out a smattering of some different samples and let us know how it goes? The 'Trigger' samples under helpers use the new XAML only setup, and then anything with buttons on the bottom is using code-behind, and anything with other content around the sample is using code-behind + xamlroot.

Copy link
Contributor

@Kyaa-dost Kyaa-dost left a comment

Choose a reason for hiding this comment

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

Thanks, @michael-hawker!! Tested out lots of lots of samples and are performing as expected 🚀

@ghost
Copy link

ghost commented Jan 19, 2021

Hello @michael-hawker!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 6 hours 42 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@michael-hawker michael-hawker merged commit 147000a into CommunityToolkit:master Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior sample app 🖼 sample bug 🐛
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sample App: OnXamlRendered does not get called.
3 participants