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

Delete button Styling moved to CommonResource.xaml ; Issue #10454 #11088

Closed
wants to merge 1 commit into from

Conversation

jelonmusk
Copy link

Issue #10454

There are a few places in the Settings UI where we have a "delete button":

Actions Page
Color Schemes Page
Profiles Page - Delete Profile
(PR Allow creating and editing unfocused appearances in the SUI #10317) Profiles Page - Delete Appearance: (just look up "Firebrick")
I moved these over to CommonResources.xaml.

I referred https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/CommonStyles/Common_themeresources.xaml
as a reference for the code modification.
The styling code for "delete button" where moved to Common Resource.xaml file

@ghost
Copy link

ghost commented Aug 31, 2021

CLA assistant check
All CLA requirements met.

<!-- DELETE BUTTON STYLING IN COLORSCHEMES.XAML FILE -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Style x:Key="SecondaryTextBlockStyle" TargetType="TextBlock">
Copy link
Member

Choose a reason for hiding this comment

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

You cannot use the x:Key="SecondaryTextBlockStyle" key here because I already used this key above for a different purpose. You need to name this style differently here like calling it x:Key="DeleteButtonStyle" here and below in the other theme dictionaries.

Copy link
Member

Choose a reason for hiding this comment

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

TargetType="TextBlock" is also not right.... I thought this was targeting Button?

Comment on lines +167 to +178
<SolidColorBrush x:Key="ButtonBackground"
Color="Firebrick" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="#C23232" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="#A21212" />
<SolidColorBrush x:Key="ButtonForeground"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="White" />
Copy link
Member

Choose a reason for hiding this comment

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

All of these likely need to turn into Setter items on Properties that are a part of Button with the color or brush binding to the relevant properties. It's sort of a backwards declaration to how it is done on an individual button override.

Copy link
Author

Choose a reason for hiding this comment

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

It doesn't look like this builds either. Did you F5 it in Visual Studio to see if your shared style works?

Thanks for reviewing.
I have gone through all your replies and I'll make all the required changes.
I'll F5 it and see if it works after correcting the current code.

@miniksa
Copy link
Member

miniksa commented Sep 1, 2021

The Button controls that are going to be using this common style instead of their individual overrides need those overrides removed and to contain the property Style="{ThemeResource WhateverYouNameTheXKeyLikeDeleteButtonStyleOrSomething}" instead so they refer to the common one.

<TextBlock Grid.Row="1"
Grid.Column="1"
Style="{ThemeResource SecondaryTextBlockStyle}"
Text="{x:Bind Author}" />

They may also need to have the CommonResources.xaml merged into their ResourceDictionary at the top before the XAML compiler will find the shared resource.

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>

@miniksa
Copy link
Member

miniksa commented Sep 1, 2021

It doesn't look like this builds either. Did you F5 it in Visual Studio to see if your shared style works?

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 2, 2021
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Sep 9, 2021
@ghost
Copy link

ghost commented Sep 9, 2021

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@ghost ghost closed this Sep 16, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants