Skip to content

Enable light templating in InAppNotification #3371

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

Conversation

vgromfeld
Copy link
Contributor

Adjusting some style properties of InAppNotification like the margin between the dismiss button and the content requires a full retemplate. We can avoid this by using named resources and allow a "light" templating by adjusting only the resources we want.

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

The default style of InAppNotification contains fixed values that are not easily customizable like the margin for the dismiss button:

<Button x:Name="PART_DismissButton"
    Margin="24,0,0,0" />

What is the new behavior?

InAppNotification default style will now use named resources for some key layout properties.
This will allow us to only redefine those property to adjust the layout instead of going through a full retemplate.

<Button x:Name="PART_DismissButton"
    Margin="{StaticResource SystemControlMSEdgeNotificationDismissButtonMargin}">

We will now be able to customize the following properties:

<x:Double x:Key="SystemControlMSEdgeNotificationDismissButtonSize">40</x:Double>
<Thickness x:Key="SystemControlMSEdgeNotificationDismissButtonMargin">24,0,0,0</Thickness>
<x:Double x:Key="SystemControlMSEdgeNotificationDismissButtonTranslate">18</x:Double>
<VerticalAlignment x:Key="SystemControlMSEdgeNotificationDismissButtonVerticalAlignment">Center</VerticalAlignment>

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)
  • 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

@ghost
Copy link

ghost commented Jun 30, 2020

Thanks vgromfeld 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 assigned Kyaa-dost Jun 30, 2020
Copy link
Contributor

@jbrianceau jbrianceau left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍. I've just one suggestion that I left in a comment.

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.

Looks good 🚀

@michael-hawker
Copy link
Member

@vgromfeld can you resolve the merge conflict here? Be careful too as #3375 also has conflicts, so not sure if incompatible.

@michael-hawker michael-hawker merged commit 74b3dd7 into CommunityToolkit:master Jul 22, 2020
@michael-hawker michael-hawker added this to the 7.0 milestone Jul 22, 2020
@vgromfeld vgromfeld deleted the inAppNotification.allowLightTemplating branch July 23, 2020 06:09
@ghost ghost added the Completed 🔥 label Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants