зеркало из https://github.com/DeGsoft/maui-linux.git
Родитель
04d44fbe82
Коммит
802ab20e71
|
@ -449,6 +449,8 @@ namespace Xamarin.Forms
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertTo = Nullable.GetUnderlyingType(convertTo) ?? convertTo;
|
||||||
|
|
||||||
value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
|
value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
|
||||||
|
x:Class="Xamarin.Forms.Xaml.UnitTests.Issue6280"
|
||||||
|
x:DataType="local:Issue6280ViewModel">
|
||||||
|
<Entry x:Name="_entry"
|
||||||
|
Text="{Binding NullableInt}"
|
||||||
|
VerticalOptions="Start" />
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,35 @@
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Xamarin.Forms.Core.UnitTests;
|
||||||
|
|
||||||
|
namespace Xamarin.Forms.Xaml.UnitTests
|
||||||
|
{
|
||||||
|
public partial class Issue6280 : ContentPage
|
||||||
|
{
|
||||||
|
public Issue6280() => InitializeComponent();
|
||||||
|
public Issue6280(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 BindingToNullable([Values(false, true)]bool useCompiledXaml)
|
||||||
|
{
|
||||||
|
var vm = new Issue6280ViewModel();
|
||||||
|
var page = new Issue6280(useCompiledXaml) { BindingContext = vm };
|
||||||
|
page._entry.SetValueFromRenderer(Entry.TextProperty, 1);
|
||||||
|
Assert.AreEqual(vm.NullableInt, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Issue6280ViewModel
|
||||||
|
{
|
||||||
|
public int? NullableInt { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче