Browse Source
feat: WindowNotificationManager: support TopCenter and BottomCenter position (#12804)
* feat: support topcenter and bottom center.
* fix: fix typo.
pull/12445/head
Dong Bin
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
28 additions and
2 deletions
-
src/Avalonia.Controls/Notifications/NotificationPosition.cs
-
src/Avalonia.Controls/Notifications/WindowNotificationManager.cs
-
src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml
-
src/Avalonia.Themes.Simple/Controls/WindowNotificationManager.xaml
|
|
|
@ -9,6 +9,8 @@ |
|
|
|
TopLeft, |
|
|
|
TopRight, |
|
|
|
BottomLeft, |
|
|
|
BottomRight |
|
|
|
BottomRight, |
|
|
|
TopCenter, |
|
|
|
BottomCenter, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -15,7 +15,7 @@ namespace Avalonia.Controls.Notifications |
|
|
|
/// An <see cref="INotificationManager"/> that displays notifications in a <see cref="Window"/>.
|
|
|
|
/// </summary>
|
|
|
|
[TemplatePart("PART_Items", typeof(Panel))] |
|
|
|
[PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")] |
|
|
|
[PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright", ":topcenter", ":bottomcenter")] |
|
|
|
public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager |
|
|
|
{ |
|
|
|
private IList? _items; |
|
|
|
@ -215,6 +215,8 @@ namespace Avalonia.Controls.Notifications |
|
|
|
PseudoClasses.Set(":topright", position == NotificationPosition.TopRight); |
|
|
|
PseudoClasses.Set(":bottomleft", position == NotificationPosition.BottomLeft); |
|
|
|
PseudoClasses.Set(":bottomright", position == NotificationPosition.BottomRight); |
|
|
|
PseudoClasses.Set(":topcenter", position == NotificationPosition.TopCenter); |
|
|
|
PseudoClasses.Set(":bottomcenter", position == NotificationPosition.BottomCenter); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -42,6 +42,11 @@ |
|
|
|
<Setter Property="HorizontalAlignment" Value="Right" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:topcenter /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="VerticalAlignment" Value="Top" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:bottomleft /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="ReverseOrder" Value="True" /> |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
@ -53,5 +58,11 @@ |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Right" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:bottomcenter /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="ReverseOrder" Value="True" /> |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" /> |
|
|
|
</Style> |
|
|
|
</ControlTheme> |
|
|
|
</ResourceDictionary> |
|
|
|
|
|
|
|
@ -38,6 +38,11 @@ |
|
|
|
<Setter Property="HorizontalAlignment" Value="Right" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:topcenter /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="VerticalAlignment" Value="Top" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:bottomleft /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="ReverseOrder" Value="True" /> |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
@ -49,5 +54,11 @@ |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Right" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="^:bottomcenter /template/ ReversibleStackPanel#PART_Items"> |
|
|
|
<Setter Property="ReverseOrder" Value="True" /> |
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom" /> |
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" /> |
|
|
|
</Style> |
|
|
|
</ControlTheme> |
|
|
|
</ResourceDictionary> |
|
|
|
|