Skip to content

Sample App: OnXamlRendered does not get called. #3673

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

Closed
2 tasks done
Rosuavio opened this issue Jan 15, 2021 · 4 comments · Fixed by #3675
Closed
2 tasks done

Sample App: OnXamlRendered does not get called. #3673

Rosuavio opened this issue Jan 15, 2021 · 4 comments · Fixed by #3675
Assignees
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 sample app 🖼
Milestone

Comments

@Rosuavio
Copy link
Contributor

Rosuavio commented Jan 15, 2021

Describe the bug

In the sample app, for samples with *.xmal.cs files, if the page inherits from IXamlRenderListener OnXamlRendered does not seem to be getting called.
My investigating showed that in this line the cast fails for the pages I tested (CarouselPage, DockPanel, AdaptiveGridView)
https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/205eedfc930e62dd8e21c8a8df63a9e75ba4955f/Microsoft.Toolkit.Uwp.SampleApp/Pages/SampleController.xaml.cs#L555

Steps to Reproduce

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Given the Sample App is open
  2. Open a sample that makes use of the functionality (like "Carousel" )
  3. Notice that the action it was supposed to take once it loaded (load carousel items for the Carousel) does not occur.

Expected behavior

For every sample that uses IXamlRenderListener and OnXamlRendered the code in OnXamlRendered is called when the sample is loaded.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 

Package Version(s): 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [x] ???? ????? Update (19042)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: ) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

@Rosuavio Rosuavio added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jan 15, 2021
@ghost ghost added the needs triage 🔍 label Jan 15, 2021
@ghost
Copy link

ghost commented Jan 15, 2021

Hello RosarioPulella, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@ghost ghost added this to the 7.0 milestone Jan 15, 2021
@michael-hawker michael-hawker self-assigned this Jan 19, 2021
@michael-hawker
Copy link
Member

I wasn't able to reproduce for AdaptiveGridView (which is parsing twice), but was able to see it for Carousel, so investigating...

@michael-hawker
Copy link
Member

Think I see the problem, assumed I'd find a XamlRoot and made wrong assumption about what to do if I didn't. Will compare against previous behavior and update.

Did also see where we update twice. We load once from the Pivot SelectionChanged and also in the SamplePage_Loaded method, but we have a comment there about not getting the event from the Pivot selection changed, so wonder if this was an OS bug which was later fixed... We could add a private value to track if we've rendered from loading the initial sample yet to only render once, but not sure if we want to mess with that now or just fix later when we work on samples in 7.1...

@michael-hawker michael-hawker changed the title Smaple App: OnXamlRendered does not get called. Sample App: OnXamlRendered does not get called. Jan 19, 2021
@michael-hawker
Copy link
Member

Alright, testing out a fix. Tried to clean-up the notion we had of the SampleContent vs SamplePage too.

michael-hawker added a commit to michael-hawker/UWPCommunityToolkit that referenced this issue Jan 19, 2021
@ghost ghost added the In-PR 🚀 label Jan 19, 2021
michael-hawker added a commit that referenced this issue Jan 19, 2021
Fixes #3673 and resolves issues with some samples not working correctly
@ghost ghost added Completed 🔥 and removed In-PR 🚀 labels Jan 19, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 sample app 🖼
Projects
None yet
3 participants