diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props
index 314d38190a..9448a31d73 100644
--- a/build/CoreLibraries.props
+++ b/build/CoreLibraries.props
@@ -3,8 +3,6 @@
-
-
diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj
index 2c6ff74e5e..bd6054327f 100644
--- a/samples/BindingDemo/BindingDemo.csproj
+++ b/samples/BindingDemo/BindingDemo.csproj
@@ -5,6 +5,7 @@
+
diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj
index 7cbd8a3f9c..e5f07c90c3 100644
--- a/samples/ControlCatalog/ControlCatalog.csproj
+++ b/samples/ControlCatalog/ControlCatalog.csproj
@@ -25,6 +25,8 @@
+
+
diff --git a/samples/ControlCatalog/Pages/TextBoxPage.xaml b/samples/ControlCatalog/Pages/TextBoxPage.xaml
index dec5f74da8..e3d0c5e4e2 100644
--- a/samples/ControlCatalog/Pages/TextBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/TextBoxPage.xaml
@@ -66,6 +66,12 @@
FontFamily="Comic Sans MS"
InputMethod.IsInputMethodEnabled="False"
Foreground="Red"/>
+
diff --git a/samples/IntegrationTestApp/IntegrationTestApp.csproj b/samples/IntegrationTestApp/IntegrationTestApp.csproj
index e8338adae6..4284399357 100644
--- a/samples/IntegrationTestApp/IntegrationTestApp.csproj
+++ b/samples/IntegrationTestApp/IntegrationTestApp.csproj
@@ -1,4 +1,4 @@
-
+
WinExe
net6.0
@@ -18,6 +18,7 @@
+
diff --git a/samples/PlatformSanityChecks/PlatformSanityChecks.csproj b/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
index 9660d2a90d..4f7f06b529 100644
--- a/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
+++ b/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
@@ -7,6 +7,7 @@
+
diff --git a/samples/Previewer/Previewer.csproj b/samples/Previewer/Previewer.csproj
index c1d14cba26..98560e9ab0 100644
--- a/samples/Previewer/Previewer.csproj
+++ b/samples/Previewer/Previewer.csproj
@@ -9,6 +9,9 @@
+
+
+
diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj
index 18a4ee5662..3c62af1eaf 100644
--- a/samples/RenderDemo/RenderDemo.csproj
+++ b/samples/RenderDemo/RenderDemo.csproj
@@ -12,6 +12,7 @@
+
diff --git a/samples/Sandbox/Sandbox.csproj b/samples/Sandbox/Sandbox.csproj
index f3c38cd96e..eab654acb6 100644
--- a/samples/Sandbox/Sandbox.csproj
+++ b/samples/Sandbox/Sandbox.csproj
@@ -10,6 +10,7 @@
+
diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj
index 2c6ff74e5e..bd6054327f 100644
--- a/samples/VirtualizationDemo/VirtualizationDemo.csproj
+++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj
@@ -5,6 +5,7 @@
+
diff --git a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj
index cd9963a2e5..81b94b4d09 100644
--- a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj
+++ b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj
@@ -22,6 +22,7 @@
+
diff --git a/samples/interop/NativeEmbedSample/NativeEmbedSample.csproj b/samples/interop/NativeEmbedSample/NativeEmbedSample.csproj
index c25442b52c..2f3ea85e46 100644
--- a/samples/interop/NativeEmbedSample/NativeEmbedSample.csproj
+++ b/samples/interop/NativeEmbedSample/NativeEmbedSample.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs
index 33cecd10a7..b93bf87fdf 100644
--- a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs
+++ b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs
@@ -17,7 +17,7 @@ namespace Avalonia.Data.Core.Plugins
new Dictionary<(Type, string), PropertyInfo?>();
///
- public bool Match(object obj, string propertyName) => GetFirstPropertyWithName(obj.GetType(), propertyName) != null;
+ public bool Match(object obj, string propertyName) => GetFirstPropertyWithName(obj, propertyName) != null;
///
/// Starts monitoring the value of a property on an object.
@@ -36,7 +36,7 @@ namespace Avalonia.Data.Core.Plugins
if (!reference.TryGetTarget(out var instance) || instance is null)
return null;
- var p = GetFirstPropertyWithName(instance.GetType(), propertyName);
+ var p = GetFirstPropertyWithName(instance, propertyName);
if (p != null)
{
@@ -50,8 +50,16 @@ namespace Avalonia.Data.Core.Plugins
}
}
- private PropertyInfo? GetFirstPropertyWithName(Type type, string propertyName)
+ private const BindingFlags PropertyBindingFlags =
+ BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
+
+ private PropertyInfo? GetFirstPropertyWithName(object instance, string propertyName)
{
+ if (instance is IReflectableType reflectableType)
+ return reflectableType.GetTypeInfo().GetProperty(propertyName, PropertyBindingFlags);
+
+ var type = instance.GetType();
+
var key = (type, propertyName);
if (!_propertyLookup.TryGetValue(key, out var propertyInfo))
@@ -66,10 +74,7 @@ namespace Avalonia.Data.Core.Plugins
{
PropertyInfo? found = null;
- const BindingFlags bindingFlags =
- BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
-
- var properties = type.GetProperties(bindingFlags);
+ var properties = type.GetProperties(PropertyBindingFlags);
foreach (PropertyInfo propertyInfo in properties)
{
diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs
index 9c1ffce24c..efcb7dfecb 100644
--- a/src/Avalonia.Base/DirectPropertyBase.cs
+++ b/src/Avalonia.Base/DirectPropertyBase.cs
@@ -2,7 +2,6 @@
using Avalonia.Data;
using Avalonia.Reactive;
using Avalonia.Styling;
-using Avalonia.Utilities;
namespace Avalonia
{
@@ -188,10 +187,10 @@ namespace Avalonia
}
else if (value is ITemplate template && !typeof(ITemplate).IsAssignableFrom(PropertyType))
{
- return new PropertySetterLazyInstance(
+ return new PropertySetterTemplateInstance(
target,
this,
- () => (TValue)template.Build());
+ template);
}
else
{
diff --git a/src/Avalonia.Base/Input/InputElement.cs b/src/Avalonia.Base/Input/InputElement.cs
index 9fe07f62dd..d3c1b3f597 100644
--- a/src/Avalonia.Base/Input/InputElement.cs
+++ b/src/Avalonia.Base/Input/InputElement.cs
@@ -144,7 +144,7 @@ namespace Avalonia.Input
///
public static readonly RoutedEvent PointerMovedEvent =
RoutedEvent.Register(
- "PointerMove",
+ "PointerMoved",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
///
diff --git a/src/Avalonia.Base/StyledPropertyBase.cs b/src/Avalonia.Base/StyledPropertyBase.cs
index dd5eb703ea..da607720ff 100644
--- a/src/Avalonia.Base/StyledPropertyBase.cs
+++ b/src/Avalonia.Base/StyledPropertyBase.cs
@@ -1,9 +1,7 @@
using System;
-using System.Diagnostics;
using Avalonia.Data;
using Avalonia.Reactive;
using Avalonia.Styling;
-using Avalonia.Utilities;
namespace Avalonia
{
@@ -12,7 +10,7 @@ namespace Avalonia
///
public abstract class StyledPropertyBase : AvaloniaProperty, IStyledPropertyAccessor
{
- private bool _inherits;
+ private readonly bool _inherits;
///
/// Initializes a new instance of the class.
@@ -243,10 +241,10 @@ namespace Avalonia
}
else if (value is ITemplate template && !typeof(ITemplate).IsAssignableFrom(PropertyType))
{
- return new PropertySetterLazyInstance(
+ return new PropertySetterTemplateInstance(
target,
this,
- () => (TValue)template.Build());
+ template);
}
else
{
diff --git a/src/Avalonia.Base/Styling/IStyleInstance.cs b/src/Avalonia.Base/Styling/IStyleInstance.cs
index 8ddb989bc0..d4f7510eb3 100644
--- a/src/Avalonia.Base/Styling/IStyleInstance.cs
+++ b/src/Avalonia.Base/Styling/IStyleInstance.cs
@@ -14,6 +14,11 @@ namespace Avalonia.Styling
///
IStyle Source { get; }
+ ///
+ /// Gets a value indicating whether this style has an activator.
+ ///
+ bool HasActivator { get; }
+
///
/// Gets a value indicating whether this style is active.
///
diff --git a/src/Avalonia.Base/Styling/PropertySetterInstance.cs b/src/Avalonia.Base/Styling/PropertySetterInstance.cs
index 48f462d006..c4e8f47e67 100644
--- a/src/Avalonia.Base/Styling/PropertySetterInstance.cs
+++ b/src/Avalonia.Base/Styling/PropertySetterInstance.cs
@@ -44,7 +44,7 @@ namespace Avalonia.Styling
{
if (hasActivator)
{
- if (_styledProperty is object)
+ if (_styledProperty is not null)
{
_subscription = _target.Bind(_styledProperty, this, BindingPriority.StyleTrigger);
}
@@ -55,13 +55,15 @@ namespace Avalonia.Styling
}
else
{
- if (_styledProperty is object)
+ var target = (AvaloniaObject) _target;
+
+ if (_styledProperty is not null)
{
- _subscription = _target.SetValue(_styledProperty!, _value, BindingPriority.Style);
+ _subscription = target.SetValue(_styledProperty!, _value, BindingPriority.Style);
}
else
{
- _target.SetValue(_directProperty!, _value);
+ target.SetValue(_directProperty!, _value);
}
}
}
diff --git a/src/Avalonia.Base/Styling/PropertySetterLazyInstance.cs b/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs
similarity index 79%
rename from src/Avalonia.Base/Styling/PropertySetterLazyInstance.cs
rename to src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs
index 92653d0064..0f6efef1be 100644
--- a/src/Avalonia.Base/Styling/PropertySetterLazyInstance.cs
+++ b/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs
@@ -11,42 +11,42 @@ namespace Avalonia.Styling
/// evaluated.
///
/// The target property type.
- internal class PropertySetterLazyInstance : SingleSubscriberObservableBase>,
+ internal class PropertySetterTemplateInstance : SingleSubscriberObservableBase>,
ISetterInstance
{
private readonly IStyleable _target;
private readonly StyledPropertyBase? _styledProperty;
private readonly DirectPropertyBase? _directProperty;
- private readonly Func _valueFactory;
+ private readonly ITemplate _template;
private BindingValue _value;
private IDisposable? _subscription;
private bool _isActive;
- public PropertySetterLazyInstance(
+ public PropertySetterTemplateInstance(
IStyleable target,
StyledPropertyBase property,
- Func valueFactory)
+ ITemplate template)
{
_target = target;
_styledProperty = property;
- _valueFactory = valueFactory;
+ _template = template;
}
- public PropertySetterLazyInstance(
+ public PropertySetterTemplateInstance(
IStyleable target,
DirectPropertyBase property,
- Func valueFactory)
+ ITemplate template)
{
_target = target;
_directProperty = property;
- _valueFactory = valueFactory;
+ _template = template;
}
public void Start(bool hasActivator)
{
_isActive = !hasActivator;
- if (_styledProperty is object)
+ if (_styledProperty is not null)
{
var priority = hasActivator ? BindingPriority.StyleTrigger : BindingPriority.Style;
_subscription = _target.Bind(_styledProperty, this, priority);
@@ -77,7 +77,7 @@ namespace Avalonia.Styling
public override void Dispose()
{
- if (_subscription is object)
+ if (_subscription is not null)
{
var sub = _subscription;
_subscription = null;
@@ -85,7 +85,7 @@ namespace Avalonia.Styling
}
else if (_isActive)
{
- if (_styledProperty is object)
+ if (_styledProperty is not null)
{
_target.ClearValue(_styledProperty);
}
@@ -101,22 +101,21 @@ namespace Avalonia.Styling
protected override void Subscribed() => PublishNext();
protected override void Unsubscribed() { }
- private T GetValue()
+ private void EnsureTemplate()
{
if (_value.HasValue)
{
- return _value.Value;
+ return;
}
- _value = _valueFactory();
- return _value.Value;
+ _value = (T) _template.Build();
}
private void PublishNext()
{
if (_isActive)
{
- GetValue();
+ EnsureTemplate();
PublishNext(_value);
}
else
diff --git a/src/Avalonia.Base/Styling/Setter.cs b/src/Avalonia.Base/Styling/Setter.cs
index b4b3399022..d989bb0706 100644
--- a/src/Avalonia.Base/Styling/Setter.cs
+++ b/src/Avalonia.Base/Styling/Setter.cs
@@ -1,9 +1,7 @@
using System;
using Avalonia.Animation;
using Avalonia.Data;
-using Avalonia.Data.Core;
using Avalonia.Metadata;
-using Avalonia.Utilities;
#nullable enable
@@ -70,12 +68,5 @@ namespace Avalonia.Styling
return Property.CreateSetterInstance(target, Value);
}
-
- private struct SetterVisitorData
- {
- public IStyleable target;
- public object? value;
- public ISetterInstance? result;
- }
}
}
diff --git a/src/Avalonia.Base/Styling/StyleInstance.cs b/src/Avalonia.Base/Styling/StyleInstance.cs
index 830cf49a0d..db96da6821 100644
--- a/src/Avalonia.Base/Styling/StyleInstance.cs
+++ b/src/Avalonia.Base/Styling/StyleInstance.cs
@@ -11,10 +11,10 @@ namespace Avalonia.Styling
///
/// A which has been instanced on a control.
///
- internal class StyleInstance : IStyleInstance, IStyleActivatorSink
+ internal sealed class StyleInstance : IStyleInstance, IStyleActivatorSink
{
- private readonly List? _setters;
- private readonly List? _animations;
+ private readonly ISetterInstance[]? _setters;
+ private readonly IDisposable[]? _animations;
private readonly IStyleActivator? _activator;
private readonly Subject? _animationTrigger;
@@ -30,41 +30,42 @@ namespace Avalonia.Styling
_activator = activator;
IsActive = _activator is null;
- if (setters is object)
+ if (setters is not null)
{
var setterCount = setters.Count;
- _setters = new List(setterCount);
+ _setters = new ISetterInstance[setterCount];
for (var i = 0; i < setterCount; ++i)
{
- _setters.Add(setters[i].Instance(Target));
+ _setters[i] = setters[i].Instance(Target);
}
}
- if (animations is object && target is Animatable animatable)
+ if (animations is not null && target is Animatable animatable)
{
var animationsCount = animations.Count;
- _animations = new List(animationsCount);
+ _animations = new IDisposable[animationsCount];
_animationTrigger = new Subject();
for (var i = 0; i < animationsCount; ++i)
{
- _animations.Add(animations[i].Apply(animatable, null, _animationTrigger));
+ _animations[i] = animations[i].Apply(animatable, null, _animationTrigger);
}
}
}
+ public bool HasActivator => _activator is not null;
public bool IsActive { get; private set; }
public IStyle Source { get; }
public IStyleable Target { get; }
public void Start()
{
- var hasActivator = _activator is object;
+ var hasActivator = HasActivator;
- if (_setters is object)
+ if (_setters is not null)
{
foreach (var setter in _setters)
{
@@ -76,7 +77,7 @@ namespace Avalonia.Styling
{
_activator!.Subscribe(this, 0);
}
- else if (_animationTrigger != null)
+ else if (_animationTrigger is not null)
{
_animationTrigger.OnNext(true);
}
@@ -84,7 +85,7 @@ namespace Avalonia.Styling
public void Dispose()
{
- if (_setters is object)
+ if (_setters is not null)
{
foreach (var setter in _setters)
{
@@ -92,11 +93,11 @@ namespace Avalonia.Styling
}
}
- if (_animations is object)
+ if (_animations is not null)
{
- foreach (var subscripion in _animations)
+ foreach (var subscription in _animations)
{
- subscripion.Dispose();
+ subscription.Dispose();
}
}
@@ -111,7 +112,7 @@ namespace Avalonia.Styling
_animationTrigger?.OnNext(value);
- if (_setters is object)
+ if (_setters is not null)
{
if (IsActive)
{
diff --git a/src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs b/src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
index e07c933039..38d559a031 100644
--- a/src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
+++ b/src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
@@ -218,6 +218,8 @@ namespace Avalonia.Controls.Primitives
{
// No explicit height values were set so we can autosize
autoSizeHeight = true;
+ // We need to invalidate desired height in order to grow or shrink as needed
+ InvalidateDesiredHeight();
measureHeight = double.PositiveInfinity;
}
else
diff --git a/src/Avalonia.Controls/Calendar/CalendarItem.cs b/src/Avalonia.Controls/Calendar/CalendarItem.cs
index c44994f92f..32fdaceacb 100644
--- a/src/Avalonia.Controls/Calendar/CalendarItem.cs
+++ b/src/Avalonia.Controls/Calendar/CalendarItem.cs
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
+using Avalonia.Collections.Pooled;
using Avalonia.Controls.Metadata;
using Avalonia.Data;
using Avalonia.Input;
@@ -172,13 +173,13 @@ namespace Avalonia.Controls.Primitives
if (MonthView != null)
{
var childCount = Calendar.RowsPerMonth + Calendar.RowsPerMonth * Calendar.ColumnsPerMonth;
- var children = new List(childCount);
+ using var children = new PooledList(childCount);
for (int i = 0; i < Calendar.RowsPerMonth; i++)
{
if (_dayTitleTemplate != null)
{
- var cell = _dayTitleTemplate.Build();
+ var cell = (Control) _dayTitleTemplate.Build();
cell.DataContext = string.Empty;
cell.SetValue(Grid.RowProperty, 0);
cell.SetValue(Grid.ColumnProperty, i);
@@ -186,11 +187,16 @@ namespace Avalonia.Controls.Primitives
}
}
+ EventHandler cellMouseLeftButtonDown = Cell_MouseLeftButtonDown;
+ EventHandler cellMouseLeftButtonUp = Cell_MouseLeftButtonUp;
+ EventHandler cellMouseEnter = Cell_MouseEnter;
+ EventHandler cellClick = Cell_Click;
+
for (int i = 1; i < Calendar.RowsPerMonth; i++)
{
for (int j = 0; j < Calendar.ColumnsPerMonth; j++)
{
- CalendarDayButton cell = new CalendarDayButton();
+ var cell = new CalendarDayButton();
if (Owner != null)
{
@@ -198,10 +204,10 @@ namespace Avalonia.Controls.Primitives
}
cell.SetValue(Grid.RowProperty, i);
cell.SetValue(Grid.ColumnProperty, j);
- cell.CalendarDayButtonMouseDown += Cell_MouseLeftButtonDown;
- cell.CalendarDayButtonMouseUp += Cell_MouseLeftButtonUp;
- cell.PointerEnter += Cell_MouseEnter;
- cell.Click += Cell_Click;
+ cell.CalendarDayButtonMouseDown += cellMouseLeftButtonDown;
+ cell.CalendarDayButtonMouseUp += cellMouseLeftButtonUp;
+ cell.PointerEnter += cellMouseEnter;
+ cell.Click += cellClick;
children.Add(cell);
}
}
@@ -214,12 +220,15 @@ namespace Avalonia.Controls.Primitives
var childCount = Calendar.RowsPerYear * Calendar.ColumnsPerYear;
var children = new List(childCount);
- CalendarButton month;
+ EventHandler monthCalendarButtonMouseDown = Month_CalendarButtonMouseDown;
+ EventHandler monthCalendarButtonMouseUp = Month_CalendarButtonMouseUp;
+ EventHandler monthMouseEnter = Month_MouseEnter;
+
for (int i = 0; i < Calendar.RowsPerYear; i++)
{
for (int j = 0; j < Calendar.ColumnsPerYear; j++)
{
- month = new CalendarButton();
+ var month = new CalendarButton();
if (Owner != null)
{
@@ -227,9 +236,9 @@ namespace Avalonia.Controls.Primitives
}
month.SetValue(Grid.RowProperty, i);
month.SetValue(Grid.ColumnProperty, j);
- month.CalendarLeftMouseButtonDown += Month_CalendarButtonMouseDown;
- month.CalendarLeftMouseButtonUp += Month_CalendarButtonMouseUp;
- month.PointerEnter += Month_MouseEnter;
+ month.CalendarLeftMouseButtonDown += monthCalendarButtonMouseDown;
+ month.CalendarLeftMouseButtonUp += monthCalendarButtonMouseUp;
+ month.PointerEnter += monthMouseEnter;
children.Add(month);
}
}
diff --git a/src/Avalonia.Controls/Canvas.cs b/src/Avalonia.Controls/Canvas.cs
index fabf8978c7..adee7d4d90 100644
--- a/src/Avalonia.Controls/Canvas.cs
+++ b/src/Avalonia.Controls/Canvas.cs
@@ -1,4 +1,5 @@
using System;
+using System.Reactive.Concurrency;
using Avalonia.Input;
using Avalonia.Layout;
@@ -159,47 +160,57 @@ namespace Avalonia.Controls
}
///
- /// Arranges the control's children.
+ /// Arranges a single child.
///
- /// The size allocated to the control.
- /// The space taken.
- protected override Size ArrangeOverride(Size finalSize)
+ /// The child to arrange.
+ /// The size allocated to the canvas.
+ protected virtual void ArrangeChild(Control child, Size finalSize)
{
- foreach (Control child in Children)
- {
- double x = 0.0;
- double y = 0.0;
- double elementLeft = GetLeft(child);
+ double x = 0.0;
+ double y = 0.0;
+ double elementLeft = GetLeft(child);
- if (!double.IsNaN(elementLeft))
- {
- x = elementLeft;
- }
- else
+ if (!double.IsNaN(elementLeft))
+ {
+ x = elementLeft;
+ }
+ else
+ {
+ // Arrange with right.
+ double elementRight = GetRight(child);
+ if (!double.IsNaN(elementRight))
{
- // Arrange with right.
- double elementRight = GetRight(child);
- if (!double.IsNaN(elementRight))
- {
- x = finalSize.Width - child.DesiredSize.Width - elementRight;
- }
+ x = finalSize.Width - child.DesiredSize.Width - elementRight;
}
+ }
- double elementTop = GetTop(child);
- if (!double.IsNaN(elementTop) )
- {
- y = elementTop;
- }
- else
+ double elementTop = GetTop(child);
+ if (!double.IsNaN(elementTop))
+ {
+ y = elementTop;
+ }
+ else
+ {
+ double elementBottom = GetBottom(child);
+ if (!double.IsNaN(elementBottom))
{
- double elementBottom = GetBottom(child);
- if (!double.IsNaN(elementBottom))
- {
- y = finalSize.Height - child.DesiredSize.Height - elementBottom;
- }
+ y = finalSize.Height - child.DesiredSize.Height - elementBottom;
}
+ }
- child.Arrange(new Rect(new Point(x, y), child.DesiredSize));
+ child.Arrange(new Rect(new Point(x, y), child.DesiredSize));
+ }
+
+ ///
+ /// Arranges the control's children.
+ ///
+ /// The size allocated to the control.
+ /// The space taken.
+ protected override Size ArrangeOverride(Size finalSize)
+ {
+ foreach (Control child in Children)
+ {
+ ArrangeChild(child, finalSize);
}
return finalSize;
diff --git a/src/Avalonia.Controls/DateTimePickers/TimePicker.cs b/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
index f04c79505e..047667567d 100644
--- a/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
+++ b/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
@@ -38,13 +38,13 @@ namespace Avalonia.Controls
/// Defines the property
///
public static readonly StyledProperty