Notification lag
See original GitHub issueDescribe the bug Notification card animation is flickering and lagging when lower animation duration is set
To Reproduce Steps to reproduce the behavior:
- Override notification manager and notification card style with this:
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:v="clr-namespace:SmartMirror.Views;assembly=SmartMirror">
<Design.PreviewWith>
<v:NotificationView/>
</Design.PreviewWith>
<Style Selector="WindowNotificationManager">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<Style Selector="NotificationCard">
<Setter Property="Template">
<ControlTemplate>
<LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
<Border CornerRadius="{DynamicResource ControlCornerRadius}" BoxShadow="0 6 8 0 #4F000000" Margin="5 5 5 10">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{DynamicResource ControlCornerRadius}" ClipToBounds="True">
<DockPanel>
<ContentControl Name="PART_Content" Content="{TemplateBinding Content}" />
</DockPanel>
</Border>
</Border>
</LayoutTransformControl>
</ControlTemplate>
</Setter>
<Style.Animations>
<Animation Duration="0:0:0.3" Easing="SineEaseIn" FillMode="Forward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="NotificationCard[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Style.Animations>
<Animation Duration="0:0:0.3" Easing="SineEaseOut" FillMode="Backward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Styles>
- Display some notifications on other than UI thread:
Thread.Sleep(1500);
RaiseNotification(mainWindow, "Error", "An error occured");
Thread.Sleep(1500);
RaiseNotification(mainWindow, "WELCOME", "Welcome");
Thread.Sleep(1500);
RaiseNotification(mainWindow, "Test", "Testing notifications");
- Dispatch on UI thread:
public static void RaiseNotification(MainWindowViewModel mainWindow, string title, string message)
{
Dispatcher.UIThread.InvokeAsync(() =>
{
mainWindow.NotificationManager.Show(new NotificationViewModel() { Title = title, Message = message });
});
}
- You sholud see flickering notification on slide down
Expected behavior To not flicker and lag
Screenshots
Desktop (please complete the following information):
- OS: Windows
- Version 0.10.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Top 10 Ways to Fix Delayed Notifications on Android
1. Avoid Force-Stopping Apps 2. Turn Off Adaptive Battery 3. Disable Battery & Data Saver 4. Disable Wi-Fi Power Saving Mode 5. Turn...
Read more >Delayed Notification Error on Android: 8 Best Ways to Fix!
Best Tips to Fix Delayed Notifications on Android · 1. Disable Adaptive Battery on Android · 2. Is Your Internet Connection Stable? ·...
Read more >Delayed notifications since Android 12 update
For apps that have delayed notifications, enable unrestricted battery use by long pressing on the app shortcut, going to App info, then battery....
Read more >How to Fix Android Delayed Notifications Issue
How to Fix Android Delayed Notifications Issue · 1. Configure Battery Optimization Based on Your Needs · 2. Turn Off Adaptive Battery on...
Read more >Why Are My Android Push Notifications Being Delayed?
Your Android phone relies on a data connection to pick up new messages and then notify you of them. If you do not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That’s cool! But in meantime I found better hack for this problem… Just set opacity to start increasing a bit later so the notifications look visually faster… have a look on this code snippet:
I also set Z-index to increase just before animation is completed so new notification does not overlap the already displayed one…
Despite of fact that this solution works the bug itself still persist so I leave this issue open and maybe it will get resolved by someone later
To understand if the animation is actually applied several times, I added the following lines of code to the animatio class:
and actually in the windows output you can see: