diff --git a/readme.md b/readme.md index c1bf5bbfde..ccdbbfb967 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 starter 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](https://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/ @@ -47,7 +47,7 @@ We also have a [nightly build](https://github.com/AvaloniaUI/Avalonia/wiki/Using ## Documentation -Documentation can be found on our website at http://avaloniaui.net/docs/. We also have a [tutorial](http://avaloniaui.net/docs/tutorial/) over there for newcomers. +Documentation can be found on our website at https://avaloniaui.net/docs/. We also have a [tutorial](https://avaloniaui.net/docs/tutorial/) over there for newcomers. ## Building and Using @@ -68,7 +68,7 @@ Avalonia is licenced under the [MIT licence](licence.md). ## Contributors -This project exists thanks to all the people who contribute. [[Contribute](http://avaloniaui.net/contributing)]. +This project exists thanks to all the people who contribute. [[Contribute](https://avaloniaui.net/contributing)]. ### Backers diff --git a/src/Avalonia.Controls.DataGrid/DataGridRow.cs b/src/Avalonia.Controls.DataGrid/DataGridRow.cs index 1adc5887c0..d5ce8dba75 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridRow.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridRow.cs @@ -917,23 +917,23 @@ namespace Avalonia.Controls //TODO Cleanup double? _previousDetailsHeight = null; - + //TODO Animation - private void DetailsContent_SizeChanged(Rect newValue) + private void DetailsContent_HeightChanged(double newValue) { if (_previousDetailsHeight.HasValue) { var oldValue = _previousDetailsHeight.Value; - _previousDetailsHeight = newValue.Height; - if (newValue.Height != oldValue && newValue.Height != _detailsDesiredHeight) + _previousDetailsHeight = newValue; + if (newValue != oldValue && newValue != _detailsDesiredHeight) { if (AreDetailsVisible && _appliedDetailsTemplate != null) { // Update the new desired height for RowDetails - _detailsDesiredHeight = newValue.Height; + _detailsDesiredHeight = newValue; - _detailsElement.ContentHeight = newValue.Height; + _detailsElement.ContentHeight = newValue; // Calling this when details are not visible invalidates during layout when we have no work // to do. In certain scenarios, this could cause a layout cycle @@ -943,19 +943,29 @@ namespace Avalonia.Controls } else { - _previousDetailsHeight = newValue.Height; + _previousDetailsHeight = newValue; } } - private void DetailsContent_BoundsChanged(Rect newValue) + + private void DetailsContent_SizeChanged(Rect newValue) { - if(_detailsContent != null) - DetailsContent_SizeChanged(newValue.Inflate(_detailsContent.Margin)); + DetailsContent_HeightChanged(newValue.Height); } private void DetailsContent_MarginChanged(Thickness newValue) { if (_detailsContent != null) DetailsContent_SizeChanged(_detailsContent.Bounds.Inflate(newValue)); } + private void DetailsContent_LayoutUpdated(object sender, EventArgs e) + { + if (_detailsContent != null) + { + var margin = _detailsContent.Margin; + var height = _detailsContent.DesiredSize.Height + margin.Top + margin.Bottom; + + DetailsContent_HeightChanged(height); + } + } //TODO Animation // Sets AreDetailsVisible on the row and animates if necessary @@ -1035,12 +1045,26 @@ namespace Avalonia.Controls if (_detailsContent != null) { - _detailsContentSizeSubscription = - System.Reactive.Disposables.StableCompositeDisposable.Create( - _detailsContent.GetObservable(BoundsProperty) - .Subscribe(DetailsContent_BoundsChanged), + if (_detailsContent is Layout.Layoutable layoutableContent) + { + layoutableContent.LayoutUpdated += DetailsContent_LayoutUpdated; + + _detailsContentSizeSubscription = + System.Reactive.Disposables.StableCompositeDisposable.Create( + System.Reactive.Disposables.Disposable.Create(() => layoutableContent.LayoutUpdated -= DetailsContent_LayoutUpdated), + _detailsContent.GetObservable(MarginProperty) + .Subscribe(DetailsContent_MarginChanged)); + + + } + else + { + _detailsContentSizeSubscription = _detailsContent.GetObservable(MarginProperty) - .Subscribe(DetailsContent_MarginChanged)); + .Subscribe(DetailsContent_MarginChanged); + + } + _detailsElement.Children.Add(_detailsContent); } } diff --git a/src/Avalonia.Input/Gestures.cs b/src/Avalonia.Input/Gestures.cs index 0efc20b196..cdfcd94692 100644 --- a/src/Avalonia.Input/Gestures.cs +++ b/src/Avalonia.Input/Gestures.cs @@ -96,8 +96,11 @@ namespace Avalonia.Input if (s_lastPress.TryGetTarget(out var target) && target == e.Source) { - var et = e.InitialPressMouseButton != MouseButton.Right ? TappedEvent : RightTappedEvent; - e.Source.RaiseEvent(new RoutedEventArgs(et)); + if (e.InitialPressMouseButton == MouseButton.Left || e.InitialPressMouseButton == MouseButton.Right) + { + var et = e.InitialPressMouseButton != MouseButton.Right ? TappedEvent : RightTappedEvent; + e.Source.RaiseEvent(new RoutedEventArgs(et)); + } } } } diff --git a/tests/Avalonia.Input.UnitTests/GesturesTests.cs b/tests/Avalonia.Input.UnitTests/GesturesTests.cs index eb930621ab..b2687c2555 100644 --- a/tests/Avalonia.Input.UnitTests/GesturesTests.cs +++ b/tests/Avalonia.Input.UnitTests/GesturesTests.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; using Avalonia.Controls; -using Avalonia.Input; using Avalonia.UnitTests; using Xunit; -namespace Avalonia.Interactivity.UnitTests +namespace Avalonia.Input.UnitTests { public class GesturesTests { @@ -45,7 +44,7 @@ namespace Avalonia.Interactivity.UnitTests } [Fact] - public void Tapped_Should_Be_Raised_For_Middle_Button() + public void Tapped_Should_Not_Be_Raised_For_Middle_Button() { Border border = new Border(); var decorator = new Decorator @@ -58,7 +57,7 @@ namespace Avalonia.Interactivity.UnitTests _mouse.Click(border, MouseButton.Middle); - Assert.True(raised); + Assert.False(raised); } [Fact]