From 9eb43451cd0873c0d12e8cf32c25ea75fbadc04a Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 16:27:44 -0400 Subject: [PATCH 01/16] Add basic fade in/fade out animations --- .../Controls/NotificationMessage.cs | 5 ++++ .../Controls/NotificationMessageContainer.cs | 26 ++++++++++++++++++- .../INotificationMessage.cs | 6 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs index 8a44d21..6b1e7ec 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs @@ -145,6 +145,11 @@ public ObservableCollection Buttons set => SetValue(ButtonsProperty, value); } + public UIElement AnimatableElement + { + get => this; + } + /// /// The overlay content property. /// diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs index 706181f..0dc6e6b 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs @@ -1,6 +1,7 @@ using System; using System.Windows; using System.Windows.Controls; +using System.Windows.Media.Animation; namespace Enterwell.Clients.Wpf.Notifications.Controls { @@ -79,7 +80,16 @@ private void ManagerOnOnMessageDismissed(object sender, NotificationMessageManag throw new InvalidOperationException( "Can't use both ItemsSource and Items collection at the same time."); - this.Items?.Remove(args.Message); + var animation = new DoubleAnimation + { + To = 0, + BeginTime = TimeSpan.FromSeconds(0), + Duration = TimeSpan.FromSeconds(0.25), + FillBehavior = FillBehavior.Stop + }; + animation.Completed += (s, a) => this.Items?.Remove(args.Message); + + (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); } /// @@ -95,6 +105,20 @@ private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerE "Can't use both ItemsSource and Items collection at the same time."); this.Items?.Add(args.Message); + if (args.Message.AnimatableElement is UIElement) + { + (args.Message.AnimatableElement as UIElement).Opacity = 0; + var animation = new DoubleAnimation + { + To = 1, + BeginTime = TimeSpan.FromSeconds(0), + Duration = TimeSpan.FromSeconds(0.25), + FillBehavior = FillBehavior.Stop + }; + animation.Completed += (s, a) => (args.Message.AnimatableElement as UIElement).Opacity = 1; + + (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); + } } /// diff --git a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs index 63c932e..bc91a3f 100644 --- a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs @@ -112,5 +112,11 @@ public interface INotificationMessage /// The text brush. /// Brush Foreground { get; set; } + + /// + /// Gets the animatable Message element for add/remove transitions. + /// Typically this is the whole Control object. + /// + UIElement AnimatableElement { get; } } } \ No newline at end of file From 18837e9fb90f329a3a2b28a5d5117791ee4aed99 Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 16:35:19 -0400 Subject: [PATCH 02/16] Make animations optional --- .../Controls/NotificationMessage.cs | 18 +++++++++++++ .../Controls/NotificationMessageContainer.cs | 27 ++++++++++++------- .../INotificationMessage.cs | 8 +++++- .../NotificationMessageBuilder.cs | 9 +++++++ .../NotificationMessageBuilderLinq.cs | 15 +++++++++++ 5 files changed, 66 insertions(+), 11 deletions(-) diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs index 6b1e7ec..df0d75f 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs @@ -145,6 +145,18 @@ public ObservableCollection Buttons set => SetValue(ButtonsProperty, value); } + /// + /// Gets or sets whether the message nimates. + /// + /// + /// Whether or not the message animates. + /// + public bool Animates + { + get => (bool)GetValue(AnimatesProperty); + set => SetValue(AnimatesProperty, value); + } + public UIElement AnimatableElement { get => this; @@ -286,6 +298,12 @@ private static void MessagePropertyChangesCallback(DependencyObject dependencyOb public static readonly DependencyProperty ButtonsProperty = DependencyProperty.Register("Buttons", typeof(ObservableCollection), typeof(NotificationMessage), new PropertyMetadata(null)); + /// + /// The animates property. + /// + public static readonly DependencyProperty AnimatesProperty = + DependencyProperty.Register("Animates", typeof(bool), typeof(NotificationMessage), new PropertyMetadata(false)); + /// /// Initializes the class. diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs index 0dc6e6b..2c5e559 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs @@ -80,16 +80,23 @@ private void ManagerOnOnMessageDismissed(object sender, NotificationMessageManag throw new InvalidOperationException( "Can't use both ItemsSource and Items collection at the same time."); - var animation = new DoubleAnimation + if (args.Message.Animates && args.Message.AnimatableElement is UIElement) { - To = 0, - BeginTime = TimeSpan.FromSeconds(0), - Duration = TimeSpan.FromSeconds(0.25), - FillBehavior = FillBehavior.Stop - }; - animation.Completed += (s, a) => this.Items?.Remove(args.Message); + var animation = new DoubleAnimation + { + To = 0, + BeginTime = TimeSpan.FromSeconds(0), + Duration = TimeSpan.FromSeconds(0.25), + FillBehavior = FillBehavior.Stop + }; + animation.Completed += (s, a) => this.Items?.Remove(args.Message); - (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); + (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); + } + else + { + this.Items?.Remove(args.Message); + } } /// @@ -105,7 +112,7 @@ private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerE "Can't use both ItemsSource and Items collection at the same time."); this.Items?.Add(args.Message); - if (args.Message.AnimatableElement is UIElement) + if (args.Message.Animates && args.Message.AnimatableElement is UIElement) { (args.Message.AnimatableElement as UIElement).Opacity = 0; var animation = new DoubleAnimation @@ -117,7 +124,7 @@ private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerE }; animation.Completed += (s, a) => (args.Message.AnimatableElement as UIElement).Opacity = 1; - (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); + (args.Message.AnimatableElement as UIElement).BeginAnimation(UIElement.OpacityProperty, animation); } } diff --git a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs index bc91a3f..72cbbee 100644 --- a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs @@ -113,9 +113,15 @@ public interface INotificationMessage /// Brush Foreground { get; set; } + /// + /// Gets or sets whether the message animates in and out. + /// + bool Animates { get; set; } + /// /// Gets the animatable Message element for add/remove transitions. - /// Typically this is the whole Control object. + /// Typically this is the whole Control object so that the entire + /// item can be animated. /// UIElement AnimatableElement { get; } } diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs index 04dd4fc..8b9e3aa 100644 --- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs +++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs @@ -109,6 +109,15 @@ public void SetForeground(Brush brush) this.Message.Foreground = brush; } + /// + /// Sets whether or not the message animates. + /// + /// + public void SetAnimates(bool animates) + { + this.Message.Animates = animates; + } + /// /// Queues the message to manager. /// diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs index 1482c73..269fd3d 100644 --- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs +++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs @@ -282,5 +282,20 @@ public static NotificationMessageBuilder Foreground( return builder; } + + /// + /// Sets whether or not the message animates. + /// + /// The builder. + /// Whether or not the message should animate. + /// + public static NotificationMessageBuilder Animates( + this NotificationMessageBuilder builder, + bool animates) + { + builder.SetAnimates(animates); + + return builder; + } } } \ No newline at end of file From d75b9f4301c87f7cd8fa551ba12ce4a1aa2f7bb5 Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 16:36:45 -0400 Subject: [PATCH 03/16] Update demo --- Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml | 2 +- Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml index 2845ecb..be81c4d 100644 --- a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml +++ b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml @@ -82,7 +82,7 @@ VerticalAlignment="Top" Background="#1751C3" Click="ButtonBaseInfoDelayOnClick" - Content="Info message with delayed dismiss (5s)" + Content="Animated info message with delayed dismiss (5s)" Style="{StaticResource NotificationMessageButtonStyle}" /> diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs index 089c783..028bfa1 100644 --- a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs +++ b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs @@ -78,6 +78,7 @@ private void ButtonBaseInfoDelayOnClick(object sender, RoutedEventArgs e) this.Manager .CreateMessage() .Accent("#1751C3") + .Animates(true) .Background("#333") .HasBadge("Info") .HasMessage("Update will be installed on next application restart. This message will be dismissed after 5 seconds.") From b777e5e553ad6c7fef015457877b7eaf2ec12a01 Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 16:41:43 -0400 Subject: [PATCH 04/16] Allow configuring of animation duration --- .../MainWindow.xaml.cs | 1 + .../Controls/NotificationMessage.cs | 23 ++++++++++++++++++- .../Controls/NotificationMessageContainer.cs | 4 ++-- .../INotificationMessage.cs | 5 ++++ .../NotificationMessageBuilder.cs | 9 ++++++++ .../NotificationMessageBuilderLinq.cs | 15 ++++++++++++ 6 files changed, 54 insertions(+), 3 deletions(-) diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs index 028bfa1..8c546e6 100644 --- a/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs +++ b/Enterwell.Clients.Wpf.Notifications.Sample/MainWindow.xaml.cs @@ -79,6 +79,7 @@ private void ButtonBaseInfoDelayOnClick(object sender, RoutedEventArgs e) .CreateMessage() .Accent("#1751C3") .Animates(true) + .AnimationDuration(2) .Background("#333") .HasBadge("Info") .HasMessage("Update will be installed on next application restart. This message will be dismissed after 5 seconds.") diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs index df0d75f..7f85c1e 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs @@ -146,7 +146,7 @@ public ObservableCollection Buttons } /// - /// Gets or sets whether the message nimates. + /// Gets or sets whether the message animates. /// /// /// Whether or not the message animates. @@ -157,6 +157,21 @@ public bool Animates set => SetValue(AnimatesProperty, value); } + /// + /// Gets or sets how long the message animates in seconds. + /// + /// + /// How long the message animates in seconds. + /// + public double AnimationDuration + { + get => (double)GetValue(AnimationDurationProperty); + set => SetValue(AnimationDurationProperty, value); + } + + /// + /// The animatable element (used for show/hide animations). + /// public UIElement AnimatableElement { get => this; @@ -304,6 +319,12 @@ private static void MessagePropertyChangesCallback(DependencyObject dependencyOb public static readonly DependencyProperty AnimatesProperty = DependencyProperty.Register("Animates", typeof(bool), typeof(NotificationMessage), new PropertyMetadata(false)); + /// + /// The animation duration property (in seconds). + /// + public static readonly DependencyProperty AnimationDurationProperty = + DependencyProperty.Register("AnimationDuration", typeof(double), typeof(NotificationMessage), new PropertyMetadata(0.25)); + /// /// Initializes the class. diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs index 2c5e559..0ca8c55 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs @@ -86,7 +86,7 @@ private void ManagerOnOnMessageDismissed(object sender, NotificationMessageManag { To = 0, BeginTime = TimeSpan.FromSeconds(0), - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromSeconds(args.Message.AnimationDuration), FillBehavior = FillBehavior.Stop }; animation.Completed += (s, a) => this.Items?.Remove(args.Message); @@ -119,7 +119,7 @@ private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerE { To = 1, BeginTime = TimeSpan.FromSeconds(0), - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromSeconds(args.Message.AnimationDuration), FillBehavior = FillBehavior.Stop }; animation.Completed += (s, a) => (args.Message.AnimatableElement as UIElement).Opacity = 1; diff --git a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs index 72cbbee..f1d5881 100644 --- a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs @@ -118,6 +118,11 @@ public interface INotificationMessage /// bool Animates { get; set; } + /// + /// Gets or sets the animation duration. + /// + double AnimationDuration { get; set; } + /// /// Gets the animatable Message element for add/remove transitions. /// Typically this is the whole Control object so that the entire diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs index 8b9e3aa..cf4f8bf 100644 --- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs +++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilder.cs @@ -118,6 +118,15 @@ public void SetAnimates(bool animates) this.Message.Animates = animates; } + /// + /// Sets the duration for the animation in seconds. + /// + /// + public void SetAnimationDuration(double duration) + { + this.Message.AnimationDuration = duration; + } + /// /// Queues the message to manager. /// diff --git a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs index 269fd3d..20b834a 100644 --- a/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs +++ b/Enterwell.Clients.Wpf.Notifications/NotificationMessageBuilderLinq.cs @@ -297,5 +297,20 @@ public static NotificationMessageBuilder Animates( return builder; } + + /// + /// Sets how long the message animates in seconds. + /// + /// The builder. + /// How long the message should animate in seconds. + /// + public static NotificationMessageBuilder AnimationDuration( + this NotificationMessageBuilder builder, + double duration) + { + builder.SetAnimationDuration(duration); + + return builder; + } } } \ No newline at end of file From f2ec9e1e9026f02b4203b717690c368c502d1c8d Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 17:15:54 -0400 Subject: [PATCH 05/16] Tweak message layout to fix animation issues --- .../Themes/Generic.xaml | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml b/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml index 81332dd..24c2e1b 100644 --- a/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml +++ b/Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml @@ -185,19 +185,6 @@ - - - - - - + + + + + From e22d0ee13a8a17ae3a4ff75fffa2ced03b95c90d Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 20:50:47 -0400 Subject: [PATCH 06/16] Extract message animation items to separate interface --- .../Controls/NotificationMessage.cs | 2 +- .../Controls/NotificationMessageContainer.cs | 59 ++++++++++++------- .../INotificationMessage.cs | 17 ------ .../INotificationMessageAnimation.cs | 24 ++++++++ 4 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 Enterwell.Clients.Wpf.Notifications/INotificationMessageAnimation.cs diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs index 7f85c1e..8797808 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessage.cs @@ -11,7 +11,7 @@ namespace Enterwell.Clients.Wpf.Notifications.Controls /// /// /// - public class NotificationMessage : Control, INotificationMessage + public class NotificationMessage : Control, INotificationMessageAnimation { /// /// Gets or sets the content of the overlay. diff --git a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs index 0ca8c55..8c8d1d5 100644 --- a/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs +++ b/Enterwell.Clients.Wpf.Notifications/Controls/NotificationMessageContainer.cs @@ -80,25 +80,38 @@ private void ManagerOnOnMessageDismissed(object sender, NotificationMessageManag throw new InvalidOperationException( "Can't use both ItemsSource and Items collection at the same time."); - if (args.Message.Animates && args.Message.AnimatableElement is UIElement) + if ((args.Message is INotificationMessageAnimation)) { - var animation = new DoubleAnimation + var animatableMessage = args.Message as INotificationMessageAnimation; + if (animatableMessage.Animates && animatableMessage.AnimatableElement is UIElement) { - To = 0, - BeginTime = TimeSpan.FromSeconds(0), - Duration = TimeSpan.FromSeconds(args.Message.AnimationDuration), - FillBehavior = FillBehavior.Stop - }; - animation.Completed += (s, a) => this.Items?.Remove(args.Message); + var animation = new DoubleAnimation + { + To = 0, + BeginTime = TimeSpan.FromSeconds(0), + Duration = TimeSpan.FromSeconds(animatableMessage.AnimationDuration), + FillBehavior = FillBehavior.Stop + }; + animation.Completed += (s, a) => RemoveMessage(args.Message); - (args.Message.AnimatableElement as UIElement)?.BeginAnimation(UIElement.OpacityProperty, animation); + (animatableMessage.AnimatableElement as UIElement).BeginAnimation(UIElement.OpacityProperty, animation); + } + else + { + RemoveMessage(args.Message); + } } else { - this.Items?.Remove(args.Message); + RemoveMessage(args.Message); } } + private void RemoveMessage(INotificationMessage message) + { + this.Items?.Remove(message); + } + /// /// Manager on message queued. /// @@ -112,19 +125,25 @@ private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerE "Can't use both ItemsSource and Items collection at the same time."); this.Items?.Add(args.Message); - if (args.Message.Animates && args.Message.AnimatableElement is UIElement) + + if ((args.Message is INotificationMessageAnimation)) { - (args.Message.AnimatableElement as UIElement).Opacity = 0; - var animation = new DoubleAnimation + var animatableMessage = args.Message as INotificationMessageAnimation; + if (animatableMessage.Animates && animatableMessage.AnimatableElement is UIElement) { - To = 1, - BeginTime = TimeSpan.FromSeconds(0), - Duration = TimeSpan.FromSeconds(args.Message.AnimationDuration), - FillBehavior = FillBehavior.Stop - }; - animation.Completed += (s, a) => (args.Message.AnimatableElement as UIElement).Opacity = 1; - (args.Message.AnimatableElement as UIElement).BeginAnimation(UIElement.OpacityProperty, animation); + (animatableMessage.AnimatableElement as UIElement).Opacity = 0; + var animation = new DoubleAnimation + { + To = 1, + BeginTime = TimeSpan.FromSeconds(0), + Duration = TimeSpan.FromSeconds(animatableMessage.AnimationDuration), + FillBehavior = FillBehavior.Stop + }; + animation.Completed += (s, a) => (animatableMessage.AnimatableElement as UIElement).Opacity = 1; + + (animatableMessage.AnimatableElement as UIElement).BeginAnimation(UIElement.OpacityProperty, animation); + } } } diff --git a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs index f1d5881..63c932e 100644 --- a/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs +++ b/Enterwell.Clients.Wpf.Notifications/INotificationMessage.cs @@ -112,22 +112,5 @@ public interface INotificationMessage /// The text brush. /// Brush Foreground { get; set; } - - /// - /// Gets or sets whether the message animates in and out. - /// - bool Animates { get; set; } - - /// - /// Gets or sets the animation duration. - /// - double AnimationDuration { get; set; } - - /// - /// Gets the animatable Message element for add/remove transitions. - /// Typically this is the whole Control object so that the entire - /// item can be animated. - /// - UIElement AnimatableElement { get; } } } \ No newline at end of file diff --git a/Enterwell.Clients.Wpf.Notifications/INotificationMessageAnimation.cs b/Enterwell.Clients.Wpf.Notifications/INotificationMessageAnimation.cs new file mode 100644 index 0000000..c8f25dc --- /dev/null +++ b/Enterwell.Clients.Wpf.Notifications/INotificationMessageAnimation.cs @@ -0,0 +1,24 @@ +using System.Windows; + +namespace Enterwell.Clients.Wpf.Notifications +{ + interface INotificationMessageAnimation : INotificationMessage + { + /// + /// Gets or sets whether the message animates in and out. + /// + bool Animates { get; set; } + + /// + /// Gets or sets the animation duration. + /// + double AnimationDuration { get; set; } + + /// + /// Gets the animatable Message element for add/remove transitions. + /// Typically this is the whole Control object so that the entire + /// item can be animated. + /// + UIElement AnimatableElement { get; } + } +} From 32a9e03c8373c9104036b8eee5382a258f0a3c03 Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Tue, 1 May 2018 20:52:47 -0400 Subject: [PATCH 07/16] Remove some unnecessary casting --- .../App.xaml | 2 +- .../Controls/NotificationMessageContainer.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml b/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml index 81d92c6..d4d6d02 100644 --- a/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml +++ b/Enterwell.Clients.Wpf.Notifications.Sample/App.xaml @@ -13,7 +13,7 @@ - +