This commit is contained in:
Rui Marinho 2018-05-04 12:35:41 +01:00
Родитель 7001572c13 4bb79f0cb0
Коммит fda8a08528
8 изменённых файлов: 73 добавлений и 9 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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)));
}
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}
}
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -7,6 +7,7 @@ namespace Xamarin.Forms.Platform.UWP
public class TableViewRenderer : ViewRenderer<TableView, Windows.UI.Xaml.Controls.ListView>
{
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;
}
}

Просмотреть файл

@ -45,6 +45,7 @@
<ItemGroup>
<Compile Include="ColorExtensions.cs" />
<Compile Include="FormsCancelButton.cs" />
<Compile Include="AlertDialog.cs" />
<Compile Include="FormsPivot.cs" />
<Compile Include="AlignmentExtensions.cs" />
<Compile Include="BrushHelpers.cs" />