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
added accent color to hamburger button #682
Conversation
Hi @markti, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! TTYL, DNFBOT; |
@@ -111,6 +116,15 @@ public double CompactPaneLength | |||
/// <summary> | |||
/// Gets or sets the Brush to apply to the background of the Pane area of the control. | |||
/// </summary> | |||
public Brush AccentColor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have this property called "HighlightColor" rather than AccentColor. AccentColor gives no clear indication what it's actually used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call it ButtonBackground
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HighlightColor sounds good. Scratch that. I like AccentBrush. It is the Accent for the control itself. Or we could go with HamburgerButtonBackground and HighlightBrush. I hate the second option and would rather not have properties (and just allow user to restyle) over this option.
Third option: Have a defined brush style that could be changed. I like this idea the best and follows the core framework controls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any precedent set forth in other controls? So far there are several name candidates: AccentColor, HighlightColor, AccentBrush, ButtonBackground, HighlightBrush, HamburgerButtonBackground.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to use this property to set the brush for the selection indicator in the same way that it is done in the standard Windows 10 apps (News and Money) so this brush will eventually be used for more than just the button background. That's why I prefer a name that is not tied specifically to the control itself. In Windows 10 apps (News, Money) the pane background is independent of the button background. However, the button background is tied to the selection indicator accent. This is why I prefer AccentColor. 1) It recognizes the Hamburger has an AccentColor and a PaneColor. 2) The Accent Color affects multiple controls rendering, 3) It should not be a gradient or some other brush but a solid color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple more examples, in 'Groove Music' and 'Movies & TV' the app does not have an AccentColor. Just a PaneBackground. The Back Button defaults to the system theme color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
News, Money, Sports each have an AccentColor (varies), PaneColor (#2B2B2B) and a Top Nav Color (#F2F2F2).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a property on the control itself, define a brush resource that is used for the background of the button. Based on your examples, you would want two brushes, one for the hamburger background and one for the selection brush.
Example:
<SolidColorBrush x:Key="HambugerMenuHamburgerBackgroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="HambugerMenuSelectionHighBrush" Color="#FFFFFF"/>
This is in line with what the core controls do for all of their brushes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be as easy to set by the developer. The Hamburger should, as part of it's defining characteristic as a control, have an Accent Color. This accent color should affect the button background as well as the visual selection indicator (vertical rectangle on the left-bound margin of the hamburger items....not yet implemented). I envision this property to control this Accent Color that will affect at least two (maybe more visual elements). Foreground is universal for text color, Background is universal for the controls background, in the case of the Hamburger Background affects the background color for the Hamburger's Content area. We (rightfully) have a Pane Background. The only thing missing is the Accent Color (or whatever we want to name it) that will control the button / visual selection indicator's background color as seen in the image below:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls"> | ||
<ResourceDictionary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This xaml file has had too many unnecessary changes made, please use xaml styler (https://marketplace.visualstudio.com/items?itemName=NicoVermeir.XAMLStyler) to align the xaml properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What unnecessary changes? I added a control template and visual states for the hamburger button. There were some xmlns that were added too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean "what unnecessary changes?" Look at the diff! If all you did to the file was add the template and visual state, that should be the only changes I see in that file. They aren't, you've changed the style of the xaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep too many unnecessary changed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was accessing from my W10 mobile phone while out with family and couldn't see the diff very well. It looks like you aren't a fan of the indentation that I made to the Resource Dictionary xmlns declarations? Is that the concern? Or is the concern that I added two more xmlns declarations and a ignorable property ("d", "mc", and "mc:Ignorable")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, please revert these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok removed extra xmlns and white space formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
Can't get the keyboard to come up on windows mobile 10 edge when replying so I'll comment in here about the property name. @skendrot suggested AccentColor and I like it over HighlightColor because it will be used for more things than just highlighting. It is intended to be used to control the color that is used in the hamburger button and item seldcttion similar to the accent color used in the news, money apps for w10. News has a Indian red and money has a green accent color that permeates the app. Hence the term accent color. |
Padding="0" | ||
VerticalAlignment="Top" | ||
AutomationProperties.Name="Main button" | ||
Background="{TemplateBinding AccentColor}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the default being set for this new TemplateBinding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @timheuer! I followed the practices used for the PaneBackground Property. There was no default set. Not in XAML nor in the Dependency property definition. If the property is unset, I expect that it will default to null which should resolve to Transparent brush being applied. This is what I observed during my manual testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set the default to be the system accent color in the Style in my latest commit.
@@ -45,6 +45,11 @@ public partial class HamburgerMenu | |||
/// <summary> | |||
/// Identifies the <see cref="PaneBackground"/> dependency property. | |||
/// </summary> | |||
public static readonly DependencyProperty AccentColorProperty = DependencyProperty.Register(nameof(AccentColor), typeof(Brush), typeof(HamburgerMenu), new PropertyMetadata(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably default to the system accent color. It should default here, but in the xaml definition of the control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will set the default to be {ThemeResource SystemAccentColor}. All agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's fine.
@@ -111,6 +116,15 @@ public double CompactPaneLength | |||
/// <summary> | |||
/// Gets or sets the Brush to apply to the background of the Pane area of the control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XML comments needs to be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
@@ -45,6 +45,11 @@ public partial class HamburgerMenu | |||
/// <summary> | |||
/// Identifies the <see cref="PaneBackground"/> dependency property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix XML comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls"> | ||
<ResourceDictionary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, please revert these changes
@markti you still need to sign the CLA before this can be merged (once approved) |
@ScottIsAFool, I signed the CLA over the weekend. Not sure what else I need to do or if there is a delay.... |
@markti there shouldn't be a delay. @deltakosh is there something you can check? |
I confirm this is immediate |
Can you try to sign it again? |
I will sign it again. |
@markti, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
Maybe I didn't do the DocuSign part. :) Anyways, signed it and committed some changes to:
|
is there anything additional changes needed by any of the reviewers? |
I was expecting the highlight as well but could be part of another PR |
@deltakosh, ok I can add that too... |
Hello some news here? :) Happy new year by the way! |
Hello? We are close to merge this one :) do you need help to add the highlight ? |
Moving it to 1.4 |
@markti How are you coming on this? Need help finishing it? |
Hello we won't add more code to Hamburger Menu because the XAML team will soon officially provide one : https://developer.microsoft.com/en-us/windows/platform/features/navigationview/?q=navigation%20view I really want to thank you for the time spent on this PR but I do not want to waste your time on a control we will deprecate in favor of XAML one. |
I also changed the visual state for the hamburger button to add a semi-transparent white overlay onto the button to mimic the style of standard Windows 10 apps.