Enterwell / Wpf.Notifications

WPF notifications UI controls (as seen in VS Code)
MIT License
398 stars 40 forks source link

GH 17/18 - Implements additional content areas #21

Closed amkuchta closed 6 years ago

amkuchta commented 6 years ago

What's new?

This PR implements new AdditionalContent areas via the use of a new .WithAdditionalContent(...) method. The new function accepts two parameters, ContentLocation (which is a new enum) and an object for the additional content (similar to .WithOverlay). The ContentLocation can be set with the following definitions:

The AdditionalContent areas sit behind the Badge, Message, and Header, allowing all of the controls to be used in tandem (e.g. if a user wants to use ContentLocation.Main to set an image as the background of their NotificationMessage) - the only exception to this rule is the OverBadge location, which is on the same Z-Index plane as the above mentioned controls.

Finally, the Overlay control now encompasses the entire NotificationMessage, including the new AdditionalContent areas, and has the foremost Z-Index, which allows it to continue to be used the way that it has been (basically, there is no change to this control).

I have included a new, rudimentary example that shows the different AdditionalContent areas via the use of background coloring:

I've also included all other features (Header, Message, Button, and Overlay) to show how all of the pieces fit together - if everyone likes how the enhancements look so far, I will update the new example to be a bit more verbose as to what is exactly being shown (this was just a "proof of concept").

Let me know what you think!

Closed Issues

AleksandarDev commented 6 years ago

I'm reviewing the code, everything except one thing looks great. It's strange to me that the ContentLocation.OverBadge puts the content above the badge instead over the badge. Is that intended behavior?

image

amkuchta commented 6 years ago

@AleksandarDev yes, that was the intended behavior - would you like me to change the name to AboveBadge to be clearer?

AleksandarDev commented 6 years ago

@amkuchta I can do it since I already have the project open and doing release prep. I just wanted to confirm this with you before. Thanks!

amkuchta commented 6 years ago

@AleksandarDev not a problem! I just realized that I need to add a DataTrigger to the second RowDefinition of the badgeGrid to set the height to * only if additionalContentOverBadge HasContent="True" - otherwise the row will have an empty value but still push the badge down, throwing off the centering.

Give me one second and I will push that up!

amkuchta commented 6 years ago

Wait. Nevermind. I did things smarter than I realized. Ignore that last comment 😆 😆 😆