diff --git a/src/Avalonia.Controls/Notifications/ReversibleStackPanel.cs b/src/Avalonia.Controls/Notifications/ReversibleStackPanel.cs
new file mode 100644
index 0000000000..b635c790e1
--- /dev/null
+++ b/src/Avalonia.Controls/Notifications/ReversibleStackPanel.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Avalonia.Layout;
+using Avalonia.Styling;
+
+namespace Avalonia.Controls
+{
+ public class ReversibleStackPanel : StackPanel
+ {
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty ReverseOrderProperty =
+ AvaloniaProperty.Register(nameof(ReverseOrder));
+
+ ///
+ /// Gets or sets if the child controls will be layed out in reverse order.
+ ///
+ public bool ReverseOrder
+ {
+ get => GetValue(ReverseOrderProperty);
+ set => SetValue(ReverseOrderProperty, value);
+ }
+
+ ///
+ protected override Size ArrangeOverride(Size finalSize)
+ {
+ var orientation = Orientation;
+ var spacing = Spacing;
+ var finalRect = new Rect(finalSize);
+ var pos = 0.0;
+
+ var children = ReverseOrder ? Children.Reverse() : Children;
+
+ foreach (Control child in children)
+ {
+ double childWidth = child.DesiredSize.Width;
+ double childHeight = child.DesiredSize.Height;
+
+ if (orientation == Orientation.Vertical)
+ {
+ var rect = new Rect(0, pos, childWidth, childHeight)
+ .Align(finalRect, child.HorizontalAlignment, VerticalAlignment.Top);
+ ArrangeChild(child, rect, finalSize, orientation);
+ pos += childHeight + spacing;
+ }
+ else
+ {
+ var rect = new Rect(pos, 0, childWidth, childHeight)
+ .Align(finalRect, HorizontalAlignment.Left, child.VerticalAlignment);
+ ArrangeChild(child, rect, finalSize, orientation);
+ pos += childWidth + spacing;
+ }
+ }
+
+ return finalSize;
+ }
+ }
+}
diff --git a/src/Avalonia.Controls/StackPanel.cs b/src/Avalonia.Controls/StackPanel.cs
index 0f55344769..07abb906b7 100644
--- a/src/Avalonia.Controls/StackPanel.cs
+++ b/src/Avalonia.Controls/StackPanel.cs
@@ -25,12 +25,6 @@ namespace Avalonia.Controls
public static readonly StyledProperty OrientationProperty =
AvaloniaProperty.Register(nameof(Orientation), Orientation.Vertical);
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty ReverseOrderProperty =
- AvaloniaProperty.Register(nameof(ReverseOrder));
-
///
/// Initializes static members of the class.
///
@@ -58,15 +52,6 @@ namespace Avalonia.Controls
set { SetValue(OrientationProperty, value); }
}
- ///
- /// Gets or sets if the child controls will be layed out in reverse order.
- ///
- public bool ReverseOrder
- {
- get => GetValue(ReverseOrderProperty);
- set => SetValue(ReverseOrderProperty, value);
- }
-
///
/// Gets the next control in the specified direction.
///
@@ -246,7 +231,7 @@ namespace Avalonia.Controls
var finalRect = new Rect(finalSize);
var pos = 0.0;
- var children = ReverseOrder ? Children.Reverse() : Children;
+ var children = Children;
foreach (Control child in children)
{
diff --git a/src/Avalonia.Themes.Default/WindowNotificationManager.xaml b/src/Avalonia.Themes.Default/WindowNotificationManager.xaml
index 4d04d30311..7c1efa2e82 100644
--- a/src/Avalonia.Themes.Default/WindowNotificationManager.xaml
+++ b/src/Avalonia.Themes.Default/WindowNotificationManager.xaml
@@ -4,8 +4,8 @@
-
-
+
+
@@ -15,29 +15,29 @@
-
-
+
+
-
-
-
-