diff --git a/Xamarin.Flex/Flex.cs b/Xamarin.Flex/Flex.cs index 104c11b1e..ceae8d7d1 100644 --- a/Xamarin.Flex/Flex.cs +++ b/Xamarin.Flex/Flex.cs @@ -721,12 +721,12 @@ namespace Xamarin.Flex float spacing = 0; if (layout.flex_grows == 0 && layout.flex_dim > 0) { layout_align(item.JustifyContent, layout.flex_dim, children_count, ref pos, ref spacing); - - if (layout.reverse) { - pos = layout.size_dim - pos; - } } + if (layout.reverse) + pos = layout.size_dim - pos; + + if (layout.reverse) { pos -= layout.vertical ? item.PaddingBottom : item.PaddingRight; } diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs index db8c65a5f..3edca9d25 100644 --- a/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs +++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs @@ -39,7 +39,8 @@ namespace Xamarin.Forms.Core.XamlC var parts = value.Split('.'); if (parts.Length == 1 || (parts.Length == 2 && parts [0] == "Color")) { var color = parts [parts.Length - 1]; - + if (color == "lightgrey") + color = "lightgray"; var fieldReference = module.ImportFieldReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"), color, isStatic: true, diff --git a/Xamarin.Forms.Core.UnitTests/FlexLayoutTests.cs b/Xamarin.Forms.Core.UnitTests/FlexLayoutTests.cs index 8a2028398..7776b9702 100644 --- a/Xamarin.Forms.Core.UnitTests/FlexLayoutTests.cs +++ b/Xamarin.Forms.Core.UnitTests/FlexLayoutTests.cs @@ -404,5 +404,28 @@ namespace Xamarin.Forms.Core.UnitTests Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(156, 6, 138, 20))); Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 32, 300, 20))); } + + [Test] + //https://github.com/xamarin/Xamarin.Forms/issues/2551 + public void TestReverseWithGrow() + { + var platform = new UnitPlatform(); + var label0 = new Label { + Platform = platform, + IsPlatformEnabled = true, + }; + FlexLayout.SetGrow(label0, 1); + var layout = new FlexLayout { + Platform = platform, + IsPlatformEnabled = true, + Direction = FlexDirection.ColumnReverse, + Children = { + label0, + } + }; + + layout.Layout(new Rectangle(0, 0, 300, 300)); + Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 0, 300, 300))); + } } } \ No newline at end of file diff --git a/Xamarin.Forms.Core/ColorTypeConverter.cs b/Xamarin.Forms.Core/ColorTypeConverter.cs index 21432db6b..a2bb2d4fb 100644 --- a/Xamarin.Forms.Core/ColorTypeConverter.cs +++ b/Xamarin.Forms.Core/ColorTypeConverter.cs @@ -156,6 +156,7 @@ namespace Xamarin.Forms case "lightcoral": return Color.LightCoral; case "lightcyan": return Color.LightCyan; case "lightgoldenrodyellow": return Color.LightGoldenrodYellow; + case "lightgrey": case "lightgray": return Color.LightGray; case "lightgreen": return Color.LightGreen; case "lightpink": return Color.LightPink; diff --git a/Xamarin.Forms.Platform.UAP/AlertDialog.cs b/Xamarin.Forms.Platform.UAP/AlertDialog.cs new file mode 100644 index 000000000..88af79b37 --- /dev/null +++ b/Xamarin.Forms.Platform.UAP/AlertDialog.cs @@ -0,0 +1,21 @@ +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Xamarin.Forms.Platform.UWP +{ + public class AlertDialog : ContentDialog + { + public ScrollBarVisibility VerticalScrollBarVisibility { get; set; } + + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + // The child template name is derived from the default style + // https://msdn.microsoft.com/en-us/library/windows/apps/mt299120.aspx + var scrollName = "ContentScrollViewer"; + if (GetTemplateChild(scrollName) is ScrollViewer contentScrollViewer) + contentScrollViewer.VerticalScrollBarVisibility = VerticalScrollBarVisibility; + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Platform.UAP/PlatformUWP.cs b/Xamarin.Forms.Platform.UAP/PlatformUWP.cs index be3632a11..87181905d 100644 --- a/Xamarin.Forms.Platform.UAP/PlatformUWP.cs +++ b/Xamarin.Forms.Platform.UAP/PlatformUWP.cs @@ -91,10 +91,11 @@ namespace Xamarin.Forms.Platform.UWP string content = options.Message ?? string.Empty; string title = options.Title ?? string.Empty; - var alertDialog = new ContentDialog + var alertDialog = new AlertDialog { Content = content, - Title = title + Title = title, + VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; if (options.Cancel != null) diff --git a/Xamarin.Forms.Platform.UAP/TableViewRenderer.cs b/Xamarin.Forms.Platform.UAP/TableViewRenderer.cs index cf3d0895f..1b67e85c1 100644 --- a/Xamarin.Forms.Platform.UAP/TableViewRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/TableViewRenderer.cs @@ -7,6 +7,7 @@ namespace Xamarin.Forms.Platform.UWP public class TableViewRenderer : ViewRenderer { bool _ignoreSelectionEvent; + bool _disposed; public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint) { @@ -47,6 +48,19 @@ namespace Xamarin.Forms.Platform.UWP base.OnElementChanged(e); } + protected override void Dispose(bool disposing) + { + if(disposing && !_disposed) + { + _disposed = true; + if(Control != null) + { + Control.SelectionChanged -= OnSelectionChanged; + } + } + base.Dispose(disposing); + } + void OnModelChanged(object sender, EventArgs e) { Control.Header = Element.Root; @@ -64,8 +78,7 @@ namespace Xamarin.Forms.Platform.UWP { foreach (object item in e.AddedItems) { - var cell = item as Cell; - if (cell != null) + if (item is Cell cell) { if (cell.IsEnabled) Element.Model.RowSelected(cell); @@ -74,6 +87,9 @@ namespace Xamarin.Forms.Platform.UWP } } + if (Control == null) + return; + Control.SelectedItem = null; } } diff --git a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj index b431eb779..19fda60b6 100644 --- a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj +++ b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj @@ -45,6 +45,7 @@ +