Closed amkuchta closed 6 years ago
Could this also be used for icons you proposed in #18 ?
I'm thinking of something like:
.WithAdditionalContent(...)
could also receive position Left,Top,Right,Bottom,Overlay. This would allow us to add any number of custom controls to any side of the message - WithOverlay
would then use this internally with Overlay position.
That could work - each location could correspond to a StackPanel
located at various points in the Grid
, and .WithAdditionalContent(...)
would append it's data to the appropriate StackPanel
Personally, I think that .WithOverlay(...)
should remain on it's own, but maybe be renamed to .WithCustomContent(...)
- that (to me) sums up it's function better than either .WithOverlay(...)
or .WithAdditionalContent(...)
do since it creates the main content for the control, not something that lies overtop of it or in addition to it.
I agree. I'm not thinking about changing existing method name for overlay or behavior. More on the line of just using this new mechanism internally to handle the overlay feature - .WithOverlay(...)
would then be just a syntactic sugar for .WithCustomContent(..., ContentLocation.Center)
for example.
I'm for it. I'll try to mock something up this weekend (I'm moving to a new position at work on Monday, so this week consists of me hectically trying to close out open action items)
@AleksandarDev any ideas on why this would not be working in my application...? I literally copied and pasted your code in the readme, but the lower content area is not rendering. Considering I wrote this, and it works in the sample app, something seems off. Thoughts?
My code (slightly modified from your example):
NotificationMessageManager.CreateMessage()
.Accent(notification.Accent)
.Background(notification.Background)
.Foreground(notification.Foreground)
.Animates(true)
.AnimationInDuration(0.25)
.AnimationOutDuration(0.25)
.HasBadge(notification.Badge)
.HasHeader(notification.Header)
.HasMessage(notification.Message)
.Dismiss().WithButton("Dismiss", button => { })
.WithAdditionalContent(ContentLocation.Bottom,
new Border
{
BorderThickness = new Thickness(0,1,0,0),
BorderBrush = ThemeManager.DetectAppStyle(Application.Current).Item1.Resources["TextBrush"] as SolidColorBrush,
Child = new CheckBox
{
Margin = new Thickness(12,8,12,8),
HorizontalAlignment = HorizontalAlignment.Left,
Content = "Do not display this in the future."
}
}
)
.Queue();
Everything you did looks good to me.
Check if you have 1.4.0
installed.
I have just created a minimal sample (attached bellow) and it seems to work just fine.
@AleksandarDev you know what helps? If, when you have implemented a custom style within your application, you update it to include new features that you have introduced yourself...
I'm an idiot.
While
.WithOverlay(...)
allows the use of custom content that overlaps the existing items in the control, adding content onto the bottom of the control becomes significantly more tricky. My recent use case is that I attempted to add aCheckBox
to the bottom of the control, and it ended up overlapping theMessage
to the point of not being readable.My suggested solution (which I am willing to implement) is to create a
RowDefinition
at the bottom of the control withHeight="Auto"
that houses aContentControl
. This would allow users to implement whatever content they like within it via the use of a call such as.WithAdditionalContent(...)
.Thoughts?