зеркало из https://github.com/DeGsoft/maui-linux.git
Merge branch '3.5.0' into 3.6.0
This commit is contained in:
Коммит
a3bcb65988
|
@ -20,6 +20,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
InputTypes _inputType;
|
||||
TextColorSwitcher _textColorSwitcher;
|
||||
TextColorSwitcher _hintColorSwitcher;
|
||||
float _defaultHeight => Context.ToPixels(42);
|
||||
|
||||
public SearchBarRenderer(Context context) : base(context)
|
||||
{
|
||||
|
@ -47,6 +48,16 @@ namespace Xamarin.Forms.Platform.Android
|
|||
return true;
|
||||
}
|
||||
|
||||
public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
|
||||
{
|
||||
var sizerequest = base.GetDesiredSize(widthConstraint, heightConstraint);
|
||||
if (Build.VERSION.SdkInt == BuildVersionCodes.N && heightConstraint == 0 && sizerequest.Request.Height == 0)
|
||||
{
|
||||
sizerequest.Request = new Size(sizerequest.Request.Width, _defaultHeight);
|
||||
}
|
||||
return sizerequest;
|
||||
}
|
||||
|
||||
protected override SearchView CreateNativeControl()
|
||||
{
|
||||
return new SearchView(Context);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh5290"
|
||||
NullableTime="{Binding Time, Mode=TwoWay}">
|
||||
</ContentPage>
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms.Core.UnitTests;
|
||||
|
||||
namespace Xamarin.Forms.Xaml.UnitTests
|
||||
{
|
||||
public class Gh5290VM
|
||||
{
|
||||
public TimeSpan? Time { get; set; }
|
||||
}
|
||||
|
||||
public partial class Gh5290 : ContentPage
|
||||
{
|
||||
public static readonly BindableProperty NullableTimeProperty =
|
||||
BindableProperty.Create("NullableTime", typeof(TimeSpan?), typeof(Gh5290), default(TimeSpan?));
|
||||
|
||||
public TimeSpan? NullableTime {
|
||||
get => (TimeSpan?)GetValue(NullableTimeProperty);
|
||||
set => SetValue(NullableTimeProperty, value);
|
||||
}
|
||||
|
||||
public Gh5290() => InitializeComponent();
|
||||
public Gh5290(bool useCompiledXaml)
|
||||
{
|
||||
//this stub will be replaced at compile time
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
class Tests
|
||||
{
|
||||
[SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
|
||||
[TearDown] public void TearDown() => Device.PlatformServices = null;
|
||||
|
||||
[Test]
|
||||
public void TwoWayBindingToNullable([Values(false, true)]bool useCompiledXaml)
|
||||
{
|
||||
var vm = new Gh5290VM { Time = TimeSpan.FromMinutes(42) };
|
||||
var layout = new Gh5290(useCompiledXaml) { BindingContext = vm };
|
||||
Assert.That(layout.NullableTime, Is.EqualTo(TimeSpan.FromMinutes(42)));
|
||||
|
||||
layout.SetValueFromRenderer(NullableTimeProperty, null);
|
||||
Assert.That(vm.Time, Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче