I am using .NET and am creating a desktop app/service that will display notifications in the corner of my Desktop when certain events are triggered. I don\'t want to use a r
I used the answer above to design my own notification window that is a bit more user friendly, in my opinion, and uses a few techniques that took me a little while to figure out. Sharing in case it helps anyone else out there.:
XAML:
Code behind:
using System;
using System.Windows;
using System.Windows.Threading;
public partial class ToastNotificationWindow
{
public ToastNotificationWindow()
{
InitializeComponent();
Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>
{
var workingArea = System.Windows.SystemParameters.WorkArea;
var transform = PresentationSource.FromVisual(this).CompositionTarget.TransformFromDevice;
var corner = transform.Transform(new Point(workingArea.Right, workingArea.Bottom));
this.Left = corner.X - this.ActualWidth - 10;
this.Top = corner.Y - this.ActualHeight;
}));
}
}