diff --git a/Changelog.md b/Changelog.md
index 5d7a991..c43b70e 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.4.0] - 2018-06-09
+### Added
+- Added `WithAdditionalContent` feature
+
+### Changed
+- `NotificationHeaderTextStyle` and `NotificationMessageTextStyle` are now aligned left horizontally (instead of stretched)
+
+### Fixed
+- `INotificationAnimation` interface is now marked as public
+
## [1.3.1] - 2018-05-30
### Fixed
- Fixed message header foreground not set by `SetForeground` method call.
diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml.cs b/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml.cs
index 4317718..2c5da0a 100644
--- a/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml.cs
+++ b/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml.cs
@@ -1,17 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace Enterwell.Clients.Wpf.Notifications.Sample
+namespace Enterwell.Clients.Wpf.Notifications.Sample
{
///
/// Interaction logic for App.xaml
///
- public partial class App : Application
+ public partial class App
{
}
}
diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml
index 20b757f..ff265ba 100644
--- a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml
+++ b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml
@@ -1,10 +1,10 @@
-
-
+
-
+
+
+
+
@@ -38,7 +41,7 @@
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs
index a77b7b0..c115374 100644
--- a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs
+++ b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs
@@ -1,10 +1,7 @@
using System;
-using System.Collections.ObjectModel;
-using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
-using Enterwell.Clients.Wpf.Notifications.Controls;
namespace Enterwell.Clients.Wpf.Notifications.Sample
{
@@ -92,16 +89,11 @@ private void ButtonBaseInfoDelayOnClick(object sender, RoutedEventArgs e)
private void ButtonBaseAdditionalContentOnClick(object sender, RoutedEventArgs e)
{
- Thickness margin = new Thickness();
- margin.Top = margin.Bottom = margin.Left = margin.Right = 5;
this.Manager
.CreateMessage()
.Accent("#1751C3")
- .Animates(true)
- .AnimationInDuration(0.5)
- .AnimationOutDuration(0.5)
.Background("#333")
- .Foreground("#000")
+ .Foreground("#333")
.HasBadge("Info")
.HasHeader("Header")
.HasMessage("This is the message!")
@@ -140,23 +132,12 @@ private void ButtonBaseAdditionalContentOnClick(object sender, RoutedEventArgs e
HorizontalAlignment = HorizontalAlignment.Stretch,
Background = Brushes.Orange
})
- .WithAdditionalContent(ContentLocation.OverBadge, new Border
+ .WithAdditionalContent(ContentLocation.AboveBadge, new Border
{
Height = 40,
Width = 40,
Background = Brushes.Indigo
})
- .WithOverlay(new ProgressBar
- {
- VerticalAlignment = VerticalAlignment.Bottom,
- HorizontalAlignment = HorizontalAlignment.Stretch,
- Height = 3,
- BorderThickness = new Thickness(0),
- Foreground = new SolidColorBrush(Color.FromArgb(128, 255, 255, 255)),
- Background = Brushes.Transparent,
- IsIndeterminate = true,
- IsHitTestVisible = false
- })
.Dismiss().WithButton("Dismiss", button => { })
.Queue();
}
diff --git a/Enterwell.Clients.Wpf.Notifications/ActionExtensions.cs b/Enterwell.Clients.Wpf.Notifications/ActionExtensions.cs
deleted file mode 100644
index 51d89c3..0000000
--- a/Enterwell.Clients.Wpf.Notifications/ActionExtensions.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-
-namespace Enterwell.Clients.Wpf.Notifications
-{
- ///
- /// The extensions.
- ///
- internal static class ActionExtensions
- {
- ///
- /// Invokes the specified action after first action was successfully invoked.
- ///
- /// The action data type.
- /// The action data type.
- /// The base action.
- /// The after base action.
- /// Returns new action that first calls baseAction and then afterBaseAction.
- public static Action DoAfter(this Action baseAction, Action afterBaseAction)
- {
- return (data1, data2) =>
- {
- baseAction?.Invoke(data1, data2);
- afterBaseAction?.Invoke(data1, data2);
- };
- }
- }
-}
\ No newline at end of file
diff --git a/Enterwell.Clients.Wpf.Notifications/ContentLocation.cs b/Enterwell.Clients.Wpf.Notifications/ContentLocation.cs
index 25e3097..7b27230 100644
--- a/Enterwell.Clients.Wpf.Notifications/ContentLocation.cs
+++ b/Enterwell.Clients.Wpf.Notifications/ContentLocation.cs
@@ -1,11 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Enterwell.Clients.Wpf.Notifications
+namespace Enterwell.Clients.Wpf.Notifications
{
+ ///
+ /// The additional content location.
+ ///
public enum ContentLocation
{
Top,
@@ -13,6 +10,6 @@ public enum ContentLocation
Left,
Right,
Main,
- OverBadge
+ AboveBadge
}
}
diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs
index db8a1e2..7d3622b 100644
--- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs
+++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs
@@ -257,10 +257,7 @@ public double AnimationOutDuration
///
/// The animatable element used for show/hide animations.
///
- public UIElement AnimatableElement
- {
- get => this;
- }
+ public UIElement AnimatableElement => this;
///
/// The animation in.
@@ -327,7 +324,7 @@ public DependencyProperty AnimationInDependencyProperty
get
{
var property = (DependencyProperty)GetValue(AnimationInDependencyPropProperty);
- return property ?? UIElement.OpacityProperty;
+ return property ?? OpacityProperty;
}
set => SetValue(AnimationInDependencyPropProperty, value);
}
@@ -340,7 +337,7 @@ public DependencyProperty AnimationOutDependencyProperty
get
{
var property = (DependencyProperty)GetValue(AnimationOutDependencyPropProperty);
- return property ?? UIElement.OpacityProperty;
+ return property ?? OpacityProperty;
}
set => SetValue(AnimationOutDependencyPropProperty, value);
}
@@ -376,7 +373,7 @@ public DependencyProperty AnimationOutDependencyProperty
DependencyProperty.Register("AdditionalContentRight", typeof(object), typeof(NotificationMessage), new PropertyMetadata(null));
///
- /// The additional content center property.
+ /// The additional content main property.
///
public static readonly DependencyProperty AdditionalContentMainProperty =
DependencyProperty.Register("AdditionalContentMain", typeof(object), typeof(NotificationMessage), new PropertyMetadata(null));
@@ -400,8 +397,7 @@ public DependencyProperty AnimationOutDependencyProperty
/// The instance containing the event data.
private static void AccentBrushPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
- var @this = dependencyObject as NotificationMessage;
- if (@this == null)
+ if (!(dependencyObject is NotificationMessage @this))
throw new NullReferenceException("Dependency object is not of valid type " + nameof(NotificationMessage));
if (@this.BadgeAccentBrush == null)
@@ -446,8 +442,7 @@ private static void AccentBrushPropertyChangedCallback(DependencyObject dependen
/// The instance containing the event data.
private static void BadgeTextPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
- var @this = dependencyObject as NotificationMessage;
- if (@this == null)
+ if (!(dependencyObject is NotificationMessage @this))
throw new NullReferenceException("Dependency object is not of valid type " + nameof(NotificationMessage));
@this.BadgeVisibility = dependencyPropertyChangedEventArgs.NewValue == null
@@ -474,8 +469,7 @@ private static void BadgeTextPropertyChangedCallback(DependencyObject dependency
/// The instance containing the event data.
private static void HeaderPropertyChangesCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
- var @this = dependencyObject as NotificationMessage;
- if (@this == null)
+ if (!(dependencyObject is NotificationMessage @this))
throw new NullReferenceException("Dependency object is not of valid type " + nameof(NotificationMessage));
@this.HeaderVisibility = dependencyPropertyChangedEventArgs.NewValue == null
@@ -502,8 +496,7 @@ private static void HeaderPropertyChangesCallback(DependencyObject dependencyObj
/// The instance containing the event data.
private static void MessagePropertyChangesCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
- var @this = dependencyObject as NotificationMessage;
- if (@this == null)
+ if (!(dependencyObject is NotificationMessage @this))
throw new NullReferenceException("Dependency object is not of valid type " + nameof(NotificationMessage));
@this.MessageVisibility = dependencyPropertyChangedEventArgs.NewValue == null
@@ -576,7 +569,7 @@ public NotificationMessage()
{
this.Buttons = new ObservableCollection
/// The builder.
/// Whether or not the message should animate.
- ///
+ /// Returns the notification message builder.
public static NotificationMessageBuilder Animates(
this NotificationMessageBuilder builder,
bool animates)
@@ -357,7 +359,7 @@ public static NotificationMessageBuilder Animates(
///
/// The builder.
/// How long the message should animate in (in seconds).
- ///
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationInDuration(
this NotificationMessageBuilder builder,
double duration)
@@ -372,7 +374,7 @@ public static NotificationMessageBuilder AnimationInDuration(
///
/// The builder.
/// How long the message should animate out (in seconds).
- ///
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationOutDuration(
this NotificationMessageBuilder builder,
double duration)
@@ -386,8 +388,8 @@ public static NotificationMessageBuilder AnimationOutDuration(
/// Sets the animation in for the message.
///
/// The builder.
- /// The message animation in.
- ///
+ /// The animation time line.
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationIn(
this NotificationMessageBuilder builder,
AnimationTimeline animation)
@@ -401,8 +403,8 @@ public static NotificationMessageBuilder AnimationIn(
/// Sets the animation out for the message.
///
/// The builder.
- /// The message animation out.
- ///
+ /// The animation time line.
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationOut(
this NotificationMessageBuilder builder,
AnimationTimeline animation)
@@ -416,8 +418,8 @@ public static NotificationMessageBuilder AnimationOut(
/// Sets the animation in dependency property for the message.
///
/// The builder.
- /// The animation in dependency property.
- ///
+ /// The animation in dependency property.
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationInDependencyProperty(
this NotificationMessageBuilder builder,
DependencyProperty property)
@@ -431,8 +433,8 @@ public static NotificationMessageBuilder AnimationInDependencyProperty(
/// Sets the animation out dependency property for the message.
///
/// The builder.
- /// The animation out dependency property.
- ///
+ /// The animation out dependency property.
+ /// Returns the notification message builder.
public static NotificationMessageBuilder AnimationOutDependencyProperty(
this NotificationMessageBuilder builder,
DependencyProperty property)
diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageFactory.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageFactory.cs
index 3281d92..9378288 100644
--- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageFactory.cs
+++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageFactory.cs
@@ -3,7 +3,7 @@
namespace Enterwell.Clients.Wpf.Notifications
{
///
- /// The noitification message factory.
+ /// The notification message factory.
///
///
public class NotificationMessageFactory : INotificationMessageFactory
diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageManagerEventArgs.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageManagerEventArgs.cs
index 2a78063..13f7ab0 100644
--- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageManagerEventArgs.cs
+++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageManagerEventArgs.cs
@@ -3,7 +3,7 @@
namespace Enterwell.Clients.Wpf.Notifications
{
///
- /// The notificaiton message manager event arguments.
+ /// The notification message manager event arguments.
///
///
public class NotificationMessageManagerEventArgs : EventArgs
diff --git a/Enterwell.Clients.Wpf.Notifications/Properties/AssemblyInfo.cs b/Enterwell.Clients.Wpf.Notifications/Properties/AssemblyInfo.cs
index 8e89c65..b1da2fd 100644
--- a/Enterwell.Clients.Wpf.Notifications/Properties/AssemblyInfo.cs
+++ b/Enterwell.Clients.Wpf.Notifications/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.1.0")]
-[assembly: AssemblyFileVersion("1.3.1.0")]
+[assembly: AssemblyVersion("1.4.0.0")]
+[assembly: AssemblyFileVersion("1.4.0.0")]
diff --git a/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml b/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml
index c21b405..1663931 100644
--- a/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml
+++ b/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml
@@ -1,7 +1,8 @@
-
+
#333333
#666666
@@ -17,6 +18,13 @@
+
+
@@ -41,25 +51,28 @@
-
-
-
+
+
+
@@ -85,28 +98,29 @@
-
-
-
+
+
+
-
@@ -120,105 +134,116 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
@@ -232,14 +257,15 @@
-
+
@@ -260,18 +286,20 @@
-
+
-
+
diff --git a/Readme.md b/Readme.md
index 0e1df72..a7d1465 100644
--- a/Readme.md
+++ b/Readme.md
@@ -116,6 +116,23 @@ manager.CreateMessage()
The `WithOverlay` allows you to set custom overlay content. In this example a progress bar is placed on the bottom of notification control. Notice the `IsHitTextVisible` is set to `false` so that notification message buttons don't lose focus due to overlay control being over the bottom part of the buttons.
+### Custom additional content for notification
+
+```c#
+manager.CreateMessage()
+ .Accent("#F15B19")
+ .Background("#F15B19")
+ .HasHeader("Lost connection to server")
+ .HasMessage("Reconnecting...")
+ .WithAdditionalContent(ContentLocation.Main, new CheckBox
+ {
+ Margin = new Thickness(16),
+ HorizontalAlignment = HorizontalAlignment.Right,
+ Content = "Don't show again"
+ })
+ .Queue();
+```
+
### Multiple notification
The `NotificationMessageContainer` has build-in support for showing multiple notifications at the same time. New notifications will show at the bottom of the message stack.