Skip to content
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

TeachingTip: Fix HeroContentPlacement being ignored when initially set from XAML markup #3271

Conversation

Felix-Dev
Copy link
Contributor

Description

This PR fixes an issue where the HeroContentPlacement API was ignored when initially set from XAML markup.

Motivation and Context

Fixes #3270.

How Has This Been Tested?

Tested manually and added API test.

Screenshots:

<muxc:TeachingTip Title="Title" Subtitle="Subtitle"
                  HeroContentPlacement="Bottom">
    <muxc:TeachingTip.HeroContent>
        <Rectangle Fill="ForestGreen" MinHeight="100" MinWidth="100" />
    </muxc:TeachingTip.HeroContent>
</muxc:TeachingTip>

image

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Sep 9, 2020
@StephenLPeters StephenLPeters added area-TeachingTip team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Sep 9, 2020
{
m_currentHeroContentEffectivePlacementMode = winrt::TeachingTipHeroContentPlacementMode::Top;
TeachingTipTestHooks::NotifyEffectiveHeroContentPlacementChanged(*this);
DoUpdateDynamicHeroContentPlacementToTop();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the no-opt was intentional, in the Auto case we do not want to reposition the hero content while the tip is open, so delay processing this change until the next time we open.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will lead to an issue where the VisualStateGroup "HeroContentPlacementStates" has no current state when the tip is launched in the Auto HeroContentPlacement mode. And according to the documentation, this should not happen: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.visualstategroup.currentstate?view=winrt-19041#remarks

Since we place the HeroContent at the top of an untargeted TeachingTip given a HeroContentPlacement of Auto we should put the VisualStateGroup in the HeroContentTop state here which is what DoUpdateDynamicHeroContentPlacementToTop() will do.

If an update of the HeroContentPlacement setting to Auto is still not desired while an untargeted TeachingTip is open I can add an additional check here to only call DoUpdateDynamicHeroContentPlacementToTop() when the tip is untargeted and unopened. Though I'm not sure why we would want to block that for untargeted TeachingTips, since in their case, the hero content will always be placed at the top of the tip and the tip itself does not have a tail we have to take into consideration here.

Copy link
Contributor

Choose a reason for hiding this comment

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

the Auto scenario means the app author wants us to decide was is best, if they wanted the hero content to be top then they could set the the property to top. We no-opt here because we believe that switching the hero content position from bottom to top while the tip is open is usually a jarring experience so we delay the switch until the next opening. Why is the null state an issue for untargetted but not targetted tips. Can we change the the Untargetted opening logic to do the same thing the targetted one does with respects to actively choosing a hero content state?


In reply to: 487262633 [](ancestors = 487262633)

Copy link
Contributor Author

@Felix-Dev Felix-Dev Sep 25, 2020

Choose a reason for hiding this comment

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

Reverted this change (removed that call). An untargeted TeachingTip will now behave the same as a targeted TeachingTip regarding its HeroContentPlacement visual state group when in Auto hero content placement mode: Once the tip is open either the Top or Bottom visual state wil be entered. Before the tip has been opened, no state is applied (HeroContentPlacementStates.CurrentState = null).

@Felix-Dev
Copy link
Contributor Author

@StephenLPeters Addressed your concerns. Please take a look.

Copy link
Contributor

@StephenLPeters StephenLPeters left a comment

Choose a reason for hiding this comment

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

:shipit:

@StephenLPeters
Copy link
Contributor

/azp run

1 similar comment
@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters StephenLPeters merged commit dfbe38b into microsoft:master Oct 2, 2020
@Felix-Dev Felix-Dev deleted the user/Felix-Dev/teachingtip-herocontentplacement-issue-fix branch October 2, 2020 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TeachingTip team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TeachingTip: HeroContentPlacement is ignored when set from XAML markup
3 participants