diff --git a/Avalonia.v3.ncrunchsolution b/Avalonia.v3.ncrunchsolution
index a2208a9a91..bef7e45524 100644
--- a/Avalonia.v3.ncrunchsolution
+++ b/Avalonia.v3.ncrunchsolution
@@ -3,6 +3,7 @@
tests\TestFiles\**.*
src\Avalonia.Build.Tasks\bin\Debug\netstandard2.0\Avalonia.Build.Tasks.dll
+ src\Avalonia.Build.Tasks\bin\Debug\netstandard2.0\Mono.Cecil.dll
True
.ncrunch
diff --git a/build/HarfBuzzSharp.props b/build/HarfBuzzSharp.props
index 873048ef21..88c4d36282 100644
--- a/build/HarfBuzzSharp.props
+++ b/build/HarfBuzzSharp.props
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/build/SkiaSharp.props b/build/SkiaSharp.props
index 4def44cbd0..a8d9332c57 100644
--- a/build/SkiaSharp.props
+++ b/build/SkiaSharp.props
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/readme.md b/readme.md
index 6a04c7e31e..19a9a8420d 100644
--- a/readme.md
+++ b/readme.md
@@ -16,7 +16,7 @@ To see the status of some of our features, please see our [Roadmap](https://gith
## 🚀 Getting Started
-The Avalonia [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) contains project and control templates that will help you get started, or you can use the .NET Core CLI. For a starer guide see our [documentation](http://avaloniaui.net/docs/quickstart/create-new-project).
+The Avalonia [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) contains project and control templates that will help you get started, or you can use the .NET Core CLI. For a starter guide see our [documentation](http://avaloniaui.net/docs/quickstart/create-new-project).
Avalonia is delivered via NuGet package manager. You can find the packages here: https://www.nuget.org/packages/Avalonia/
diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml
index d812818ed8..fa4fd7dd07 100644
--- a/samples/ControlCatalog/MainView.xaml
+++ b/samples/ControlCatalog/MainView.xaml
@@ -56,6 +56,7 @@
+
diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
index 08bb1584a9..304782dbf9 100644
--- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
+++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
@@ -1,6 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
ItemsRepeater
@@ -12,8 +36,6 @@
Stack - Horizontal
UniformGrid - Vertical
UniformGrid - Horizontal
- WrapLayout - Horizontal
- WrapLayout - Veritcal
@@ -25,20 +47,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs
index a4003cadc9..9e898c4536 100644
--- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs
@@ -38,6 +38,12 @@ namespace ControlCatalog.Pages
AvaloniaXamlLoader.Load(this);
}
+ public void OnSelectTemplateKey(object sender, SelectTemplateEventArgs e)
+ {
+ var item = (ItemsRepeaterPageViewModel.Item)e.DataContext;
+ e.TemplateKey = (item.Index % 2 == 0) ? "even" : "odd";
+ }
+
private void LayoutChanged(object sender, SelectionChangedEventArgs e)
{
if (_repeater == null)
diff --git a/samples/ControlCatalog/Pages/RelativePanelPage.axaml b/samples/ControlCatalog/Pages/RelativePanelPage.axaml
new file mode 100644
index 0000000000..3657d52bd9
--- /dev/null
+++ b/samples/ControlCatalog/Pages/RelativePanelPage.axaml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/ControlCatalog/Pages/RelativePanelPage.axaml.cs b/samples/ControlCatalog/Pages/RelativePanelPage.axaml.cs
new file mode 100644
index 0000000000..11d0a5152e
--- /dev/null
+++ b/samples/ControlCatalog/Pages/RelativePanelPage.axaml.cs
@@ -0,0 +1,19 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace ControlCatalog.Pages
+{
+ public class RelativePanelPage : UserControl
+ {
+ public RelativePanelPage()
+ {
+ this.InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}
diff --git a/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs b/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
index 73aaeff994..f893a6e28e 100644
--- a/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
@@ -62,13 +62,9 @@ namespace ControlCatalog.ViewModels
public class Item : ReactiveObject
{
private double _height = double.NaN;
- private int _index;
-
- public Item(int index)
- {
- _index = index;
- }
+ public Item(int index) => Index = index;
+ public int Index { get; }
public string Text { get; set; }
public double Height
@@ -76,8 +72,6 @@ namespace ControlCatalog.ViewModels
get => _height;
set => this.RaiseAndSetIfChanged(ref _height, value);
}
-
- public IBrush Background => ((_index % 2) == 0) ? Brushes.Yellow : Brushes.Wheat;
}
}
}
diff --git a/src/Avalonia.Controls/Presenters/TextPresenter.cs b/src/Avalonia.Controls/Presenters/TextPresenter.cs
index 09f86f462c..6e534bbb2a 100644
--- a/src/Avalonia.Controls/Presenters/TextPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/TextPresenter.cs
@@ -273,7 +273,7 @@ namespace Avalonia.Controls.Presenters
return new FormattedText
{
Constraint = constraint,
- Typeface = FontManager.Current?.GetOrAddTypeface(FontFamily, FontWeight, FontStyle),
+ Typeface = FontManager.Current?.GetOrAddTypeface(FontFamily, FontStyle, FontWeight),
FontSize = FontSize,
Text = text ?? string.Empty,
TextAlignment = TextAlignment,
@@ -490,7 +490,7 @@ namespace Avalonia.Controls.Presenters
return new FormattedText
{
Text = "X",
- Typeface = FontManager.Current?.GetOrAddTypeface(FontFamily, FontWeight, FontStyle),
+ Typeface = FontManager.Current?.GetOrAddTypeface(FontFamily, FontStyle, FontWeight),
FontSize = FontSize,
TextAlignment = TextAlignment,
Constraint = availableSize,
diff --git a/src/Avalonia.Controls/Primitives/AccessText.cs b/src/Avalonia.Controls/Primitives/AccessText.cs
index dd33023e38..89f672deaa 100644
--- a/src/Avalonia.Controls/Primitives/AccessText.cs
+++ b/src/Avalonia.Controls/Primitives/AccessText.cs
@@ -97,9 +97,7 @@ namespace Avalonia.Controls.Primitives
{
var lastLine = TextLayout.TextLines[TextLayout.TextLines.Count - 1];
- var offsetX = lastLine.LineMetrics.BaselineOrigin.X;
-
- var lineX = offsetX + lastLine.LineMetrics.Size.Width;
+ var lineX = lastLine.LineMetrics.Size.Width;
var lineY = Bounds.Height - lastLine.LineMetrics.Size.Height;
@@ -117,7 +115,7 @@ namespace Avalonia.Controls.Primitives
continue;
}
- var currentX = textLine.LineMetrics.BaselineOrigin.X;
+ var currentX = 0.0;
foreach (var textRun in textLine.TextRuns)
{
diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs
index c91adaa26e..29e7f28b44 100644
--- a/src/Avalonia.Controls/Primitives/Track.cs
+++ b/src/Avalonia.Controls/Primitives/Track.cs
@@ -353,6 +353,15 @@ namespace Avalonia.Controls.Primitives
var trackLength = isVertical ? arrangeSize.Height : arrangeSize.Width;
double thumbMinLength = 10;
+ StyledProperty minLengthProperty = isVertical ? MinHeightProperty : MinWidthProperty;
+
+ var thumb = Thumb;
+
+ if (thumb != null && thumb.IsSet(minLengthProperty))
+ {
+ thumbMinLength = thumb.GetValue(minLengthProperty);
+ }
+
thumbLength = trackLength * viewportSize / extent;
CoerceLength(ref thumbLength, trackLength);
thumbLength = Math.Max(thumbMinLength, thumbLength);
diff --git a/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs b/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs
new file mode 100644
index 0000000000..f93de5ca15
--- /dev/null
+++ b/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs
@@ -0,0 +1,546 @@
+using Avalonia.Layout;
+
+#nullable enable
+
+namespace Avalonia.Controls
+{
+ public partial class RelativePanel
+ {
+ private static void OnAlignPropertiesChanged(AvaloniaObject d, AvaloniaPropertyChangedEventArgs e)
+ {
+ if (d is Layoutable layoutable && layoutable.Parent is Layoutable layoutableParent)
+ {
+ layoutableParent.InvalidateArrange();
+ }
+ }
+
+ static RelativePanel()
+ {
+ ClipToBoundsProperty.OverrideDefaultValue(true);
+
+ AboveProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignBottomWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignBottomWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignHorizontalCenterWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignHorizontalCenterWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignLeftWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignLeftWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignRightWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignRightWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignTopWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignTopWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignVerticalCenterWithPanelProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ AlignVerticalCenterWithProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ BelowProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ LeftOfProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ LeftOfProperty.Changed.AddClassHandler(OnAlignPropertiesChanged);
+ }
+
+ ///
+ /// Gets the value of the RelativePanel.Above XAML attached property for the target element.
+ ///
+ /// The object from which the property value is read.
+ ///
+ /// The RelativePanel.Above XAML attached property value of the specified object.
+ /// (The element to position this element above.)
+ ///
+ [ResolveByName]
+ public static object GetAbove(AvaloniaObject obj)
+ {
+ return (object)obj.GetValue(AboveProperty);
+ }
+
+ ///
+ /// Sets the value of the RelativePanel.Above XAML attached property for a target element.
+ ///
+ /// The object to which the property value is written.
+ /// The value to set. (The element to position this element above.)
+ public static void SetAbove(AvaloniaObject obj, object value)
+ {
+ obj.SetValue(AboveProperty, value);
+ }
+
+
+ ///
+ /// Identifies the XAML attached property.
+ ///
+
+ public static readonly AttachedProperty