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

Add Custom mode to ColorZone #1611

Merged
merged 8 commits into from
Jan 31, 2020
Merged

Add Custom mode to ColorZone #1611

merged 8 commits into from
Jan 31, 2020

Conversation

ahmed-abdelrazek
Copy link
Contributor

@ahmed-abdelrazek ahmed-abdelrazek commented Jan 18, 2020

Now you can use CustomBackground and CustomForeground for the ColorZone if you choose Custom as its mode because sometimes you need your own colors like for a GroupBox or something

fixes #1391

@Keboo Keboo added this to the 3.1.0 milestone Jan 19, 2020
@Keboo
Copy link
Member

Keboo commented Jan 22, 2020

Though this works I suspect there is a slightly simpler solution.
Rather than adding a "Custom" member to the enum, I would suggest we simply add a "None" member. Then simply remove the style trigger, CustomBackground, and CustomForeground.

This would also line up with the normal enum recommendation of having a None zero member.
https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229058(v=vs.100)?redirectedfrom=MSDN

This then lets you use the Foreground and Background properties.

Thoughts?

@ahmediddma
Copy link
Contributor

None for the Mode may give the wrong idea i think we shuld keep Custom but removing CustomBackground and CustomForeground and using the already existing Background and Foreground is a good idea

@jespersh
Copy link
Contributor

Thoughts?

Thinking about this after looking into it a bit more. Wouldn't setting it to Standard (the first enum member) and setting Foreground and Background give the same result?

@ahmediddma
Copy link
Contributor

ahmediddma commented Jan 22, 2020

Thoughts?

Thinking about this after looking into it a bit more. Wouldn't setting it to Standard (the first enum member) and setting Foreground and Background give the same result?

yes. i just checked my bad

@Keboo
Copy link
Member

Keboo commented Jan 23, 2020

Upon further consideration I think we should actually keep this implementation. The linked issued #1391, it about wanting some mechanism of control for setting the colors of the GroupBox header. It is true you can hack around it by declaring alternate theme resources but this also would affect the content inside of the group box which is problematic.

I would like to see this PR move a little further forward in implementing that link (likely through attached properties) with a sample in the demo app of changing the group box header color. But other than that I think this is fine.

…olorZone assist class and remvoe Custom from their names

Add Custom GroupBox to the demo app and edit the Custom ColorZone Demo to reflect the new changes
@ahmed-abdelrazek
Copy link
Contributor Author

There are 1 custom ColorZone and 1 custom GroupBox in the demo now

You can set the custom colors from ColorZoneAssist class instead of the ColorZone class with ColorZoneAssist.Foreground and ColorZoneAssist.Background instead of CustomForeground/Background

you can't run the demo and see the changes for now because of a runtime error

System.Windows.Markup.XamlParseException: 'Could not load file or assembly 'ICSharpCode.AvalonEdit, Version=6.0.178.0, Culture=neutral, PublicKeyToken=9cc39be672370310' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

@Keboo
Copy link
Member

Keboo commented Jan 31, 2020

Great work. Thanks for the contribution!

@Keboo Keboo merged commit a39f19e into MaterialDesignInXAML:master Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't set GroupBox borders to a custom color
4 participants