diff --git a/samples/ControlCatalog/Pages/ButtonPage.xaml b/samples/ControlCatalog/Pages/ButtonPage.xaml
index 38757148ab..a4690e32e1 100644
--- a/samples/ControlCatalog/Pages/ButtonPage.xaml
+++ b/samples/ControlCatalog/Pages/ButtonPage.xaml
@@ -18,7 +18,7 @@
diff --git a/src/Avalonia.Base/Utilities/MathUtilities.cs b/src/Avalonia.Base/Utilities/MathUtilities.cs
index ab21e5fda0..dcb3ef4a2b 100644
--- a/src/Avalonia.Base/Utilities/MathUtilities.cs
+++ b/src/Avalonia.Base/Utilities/MathUtilities.cs
@@ -1,7 +1,6 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
namespace Avalonia.Utilities
{
///
@@ -31,5 +30,28 @@ namespace Avalonia.Utilities
return val;
}
}
+
+ ///
+ /// Clamps a value between a minimum and maximum value.
+ ///
+ /// The value.
+ /// The minimum value.
+ /// The maximum value.
+ /// The clamped value.
+ public static int Clamp(int val, int min, int max)
+ {
+ if (val < min)
+ {
+ return min;
+ }
+ else if (val > max)
+ {
+ return max;
+ }
+ else
+ {
+ return val;
+ }
+ }
}
}
diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
index f31a48b2a0..b177dc50cf 100644
--- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
+++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
@@ -76,9 +76,23 @@ namespace Avalonia.Controls.Presenters
var firstIndex = ItemCount - panel.Children.Count;
RecycleContainersForMove(firstIndex - FirstIndex);
- panel.PixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ?
- panel.Children[0].Bounds.Height :
- panel.Children[0].Bounds.Width;
+ double pixelOffset;
+ var child = panel.Children[0];
+
+ if (child.IsArrangeValid)
+ {
+ pixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ?
+ child.Bounds.Height :
+ child.Bounds.Width;
+ }
+ else
+ {
+ pixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ?
+ child.DesiredSize.Height :
+ child.DesiredSize.Width;
+ }
+
+ panel.PixelOffset = pixelOffset;
}
}
}
@@ -402,6 +416,10 @@ namespace Avalonia.Controls.Presenters
var panel = VirtualizingPanel;
var generator = Owner.ItemContainerGenerator;
var selector = Owner.MemberSelector;
+
+ //validate delta it should never overflow last index or generate index < 0
+ delta = MathUtilities.Clamp(delta, -FirstIndex, ItemCount - FirstIndex - panel.Children.Count);
+
var sign = delta < 0 ? -1 : 1;
var count = Math.Min(Math.Abs(delta), panel.Children.Count);
var move = count < panel.Children.Count;
diff --git a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml
index 46767feca0..bf778fcc93 100644
--- a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml
+++ b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml
@@ -9,34 +9,34 @@
#33119EDA
#FFFFFFFF
- #FFAAAAAA
+ #FFAAAAAA
#FF888888
- #FF333333
- #FFFFFFFF
+ #FF333333
+ #FFFFFFFF
#FFAAAAAA
- #FF888888
+ #FF888888
#FFF0F0F0
#FFD0D0D0
- #FF808080
+ #FF808080
#FF000000
- #FF808080
+ #FF808080
#FF086F9E
#FFFF0000
- #10FF0000
+ #10FF0000
-
+
-
-
+
+
-
+
-
+
-
+
@@ -44,7 +44,7 @@
-
+
2
0.5
diff --git a/src/Avalonia.Themes.Default/Button.xaml b/src/Avalonia.Themes.Default/Button.xaml
index 94fcce5e0c..698ddec2a8 100644
--- a/src/Avalonia.Themes.Default/Button.xaml
+++ b/src/Avalonia.Themes.Default/Button.xaml
@@ -1,7 +1,7 @@
diff --git a/src/Avalonia.Themes.Default/CalendarDayButton.xaml b/src/Avalonia.Themes.Default/CalendarDayButton.xaml
index 4a971ef0cb..2d79e62a75 100644
--- a/src/Avalonia.Themes.Default/CalendarDayButton.xaml
+++ b/src/Avalonia.Themes.Default/CalendarDayButton.xaml
@@ -100,10 +100,10 @@
diff --git a/src/Avalonia.Themes.Default/DatePicker.xaml b/src/Avalonia.Themes.Default/DatePicker.xaml
index 93bafdb56f..3fb760d35b 100644
--- a/src/Avalonia.Themes.Default/DatePicker.xaml
+++ b/src/Avalonia.Themes.Default/DatePicker.xaml
@@ -29,7 +29,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0"
- Background="{DynamicResource ThemeControlLightBrush}"
+ Background="{DynamicResource ThemeControlLowBrush}"
ColumnDefinitions="*,*,*,*"
RowDefinitions="23*,19*,19*,19*"
ClipToBounds="False">
@@ -47,12 +47,12 @@
Grid.Row="1"
Grid.RowSpan="3"
BorderThickness="1"
- BorderBrush="{DynamicResource ThemeBorderDarkBrush}"
+ BorderBrush="{DynamicResource ThemeBorderHighBrush}"
CornerRadius=".5" />
+ Foreground="{DynamicResource ThemeBorderHighBrush}">
-
+
@@ -123,7 +123,7 @@
diff --git a/src/Avalonia.Themes.Default/DropDown.xaml b/src/Avalonia.Themes.Default/DropDown.xaml
index c57d961f4b..451f1c2f23 100644
--- a/src/Avalonia.Themes.Default/DropDown.xaml
+++ b/src/Avalonia.Themes.Default/DropDown.xaml
@@ -52,6 +52,6 @@
\ No newline at end of file
diff --git a/src/Avalonia.Themes.Default/Expander.xaml b/src/Avalonia.Themes.Default/Expander.xaml
index b34189bac0..d63f785e77 100644
--- a/src/Avalonia.Themes.Default/Expander.xaml
+++ b/src/Avalonia.Themes.Default/Expander.xaml
@@ -108,7 +108,7 @@