enterwell / wpf.notifications Goto Github PK
View Code? Open in Web Editor NEWWPF notifications UI controls (as seen in VS Code)
License: MIT License
WPF notifications UI controls (as seen in VS Code)
License: MIT License
Would be great to have a property indicating whether a message is currently or still visible or already dismissed / closed.
hi how i can update my progressbar value?
i have this but i cant update value after that.
.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 = false,
IsHitTestVisible = false,
Value = 25
})
Could you port your library to AvaloniaUI?
NotificationMessageBuilder.DismissNotificationMessageButton
needs to be refactored to NotificationMessageBuilder.DismissNotificationMessage
Implement following builder methods:
public static NotificationMessageBuilder Delayed(
this NotificationMessageBuilder.DismissNotificationMessage dismiss,
long delayMilliseconds,
Action<INotificationMessage> callback = null)
public static NotificationMessageBuilder Delayed(
this NotificationMessageBuilder.DismissNotificationMessage dismiss,
TimeSpan delay,
Action<INotificationMessage> callback = null)
Delay is required (no default), callback is optional.
Use case:
var builder = this.Manager
.CreateMessage()
.Accent("#E0A030")
.Background("#333")
.HasBadge("Warn")
.HasMessage("Failed to retrieve data.")
.WithButton("Try again", button => { })
.Dismiss().Delayed(5000);
Should still support Dismiss().WithButton()
API for backward-compatibility.
Reported in #14
Yeah, it's a bug. Since you're doing CreateMessage call from VM constructor, the message container in the view isn't yet bound to the manager.
NotificationMessageContainer only listens for OnMessageQueued and that's not triggered when you give it a manager with message already in queue.
Here after attaching event handlers, ManagerOnOnMessageDismissed should be called for all existing messages and ManagerOnOnMessageQueued for each message from the new manager.
Could this be it? Can you test this by not calling CreateMessage from constructor but for example on view Loaded?
hi i use version 1.4.1 but when i use animate(true) my notification dont close. dissmisWithButton and DissmisWithDelay both not work.
it work if i use animate(false)
How can I change the text color?
It's all okay when the colors are darker, but if I want to replace them, white background lets say?
Can we have an input that specifies the maximum amount of notifications that can be shown in the screen?
this.NotificationsManager
.CreateMessage()
.Accent("#F19021")
.Background(SupervisorPalette.Palette.AlternativeColor.ToString())
.Foreground(SupervisorPalette.Palette.MarkerColor.ToString())
.Animates(true)
.AnimationInDuration(0.4)
.AnimationOutDuration(0.1)
.HasBadge("Info")
.HasMessage("Update will be installed on next application restart.")
.Dismiss().WithButton("Update now", UpdateNowCallback)
.Dismiss().WithButton("Later", button => { })
.Queue();
Requested in #3
This should be an optional parameter because animations can be taxing on application performance.
hi i want after user clicked on button notification close but dont work can you help?
var builder = this.Manager
.CreateMessage()
.Accent(AppVariable.RED)
.Background(AppVariable.BGBLACK)
.HasBadge("هشدار")
.HasHeader(string.Format("آیا برای حذف {1} {0} اطمینان دارید؟", SchoolName, Type))
.WithButton("بله", button =>
{
switch (Type)
{
case "مدرسه":
//AddSchool.main.tabc.SelectedIndex = 0;
break;
case "دانش آموز":
AddStudent.main.deleteStudent();
break;
case "کاربر":
//AddStudent.main.tabc.SelectedIndex = 0;
break;
}
})
.Dismiss().WithButton("خیر", button => { });
builder.Queue();
when i click on "بله" button after doing some work notification dont close automaticly
Would be great if we could enumerate the manager queue, checking if it contains a specific message and close / get messages by code.
While the badges are useful, users may also want to include some sort of icon or image alongside or instead of the badge to denote the control's meaning (e.g. an exclamation point instead of "Warning" text). My proposed solution is to include a ContentControl
that sits to the left of the badge in an Auto-sixing column that would allow users to insert a graphic (e.g. and icon or perhaps a logged-in user image).
If it's agreed upon, I will mock it up and submit a PR for approval.
Hello,
I'm currently developing an application that monitors vital data. I want to use your notification to inform users about connection losses from the monitor. The application consists of a MainWindow with UserControls, arranged in a grid. Each one of these UserControl-Windows should receive a NotificationMessageManager in order to have error messages on top of each window.
As you can see it works for one UserControl. My question is if there is a way to get this working for all UserControl-Windows.
As far as I understood I need to somehow dynamically generate NotificationMessageManagers in my MainWindow, as they have to be instantiated there as it seems. The NotificationMessageManagers must then be binded dynamically which can't be in XAML.
I'm really thankful for any advice because I'm pretty new to C# and stuck on this issue for quite a while!
Thanks a lot!
This may be related to #1 , but I am having issues with getting a notification to launch using an MVVM pattern. Relevant code is below; if you'd like to take a look at the application yourself, please feel free to clone from here - if you run into any issues getting the application to start, let me know, you may need to work some magic to get the application to run in Visual Studio.
...
<!--Namespace/DataContext declaration-->
xmlns:Notifications="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls;assembly=Enterwell.Clients.Wpf.Notifications"
DataContext="{Binding Main, Source={StaticResource Locator}}"
...
<!--NotificationMessageContainer is placed within a Grid-->
<Notifications:NotificationMessageContainer
Background="{DynamicResource WindowBackgroundBrush}"
Foreground="{DynamicResource LabelTextBrush}"
Manager="{Binding NotificationMessageManager}" />
...
// Instantiate NotificationMessageManager, which the View is bound to above
public INotificationMessageManager NotificationMessageManager { get; } = new NotificationMessageManager();
...
// Create the message in the constructor
public MainViewModel()
{
try
{
NotificationMessageManager.CreateMessage()
.Accent("#1751C3")
.Animates(true)
.AnimationInDuration(0.75)
.AnimationOutDuration(2)
.HasBadge("Info")
.HasMessage("Please ingest the latest STIG Compilation Library on the settings page.")
.Dismiss().WithButton("Dismiss", button => { })
.Queue();
}
catch (Exception exception)
{
log.Error(string.Format("Unable to instantiate MainViewModel."));
log.Debug("Exception details:", exception);
}
}
...
Running through a quick debug, NotificationMessageManager
is properly instantiated and the message is created and associated to it. Similarly, looking at the visual tree, the NotificationMessageContainer
exists, but is empty. Finally, no error messages are generated and logged, and my output window isn't throwing anything concerning this control, so I have nothing to suggest that anything is failing.
Thanks in advance! I love the way this looks, so I am really hoping to be able to utilize the control. However, I am following a strict "no code behind" policy, which I would rather not violate.
PM> Install-Package Enterwell.Clients.Wpf.Notifications
Installing 'Enterwell.Clients.Wpf.Notifications 1.0.0'.
Successfully installed 'Enterwell.Clients.Wpf.Notifications 1.0.0'.
Adding 'Enterwell.Clients.Wpf.Notifications 1.0.0' to UINotifications.
Uninstalling 'Enterwell.Clients.Wpf.Notifications 1.0.0'.
Successfully uninstalled 'Enterwell.Clients.Wpf.Notifications 1.0.0'.
Install failed. Rolling back...
Install-Package : Could not install package 'Enterwell.Clients.Wpf.Notifications 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references
or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
"Hello, please modify the project's framework from 4.6 to 4.5." #11 (comment)
@ghost1372 Microsoft doesn't support .NET 4.5 since Jan. 2016. We could retarget 4.5.2 if you want.
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 a CheckBox
to the bottom of the control, and it ended up overlapping the Message
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 with Height="Auto"
that houses a ContentControl
. This would allow users to implement whatever content they like within it via the use of a call such as .WithAdditionalContent(...)
.
Thoughts?
Is it possible to make it disappear after n seconds, implement like a small timer instead of just clicking buttons?
Let's say I get a notification and if I don't click it for 5 seconds it automatically disappears...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.