when closing the Picker by tapping outside or hitting done, verify the source selection index matches the UI control. When it is in spin, the animation completes offscreen and the next time it opens you see the wrong row selected. (#1054)

This commit is contained in:
David Ortinau 2017-07-24 17:00:20 -04:00 коммит произвёл E.Z. Hart
Родитель 7303d60ab6
Коммит e828fa6fa5
3 изменённых файлов: 36 добавлений и 0 удалений

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

@ -0,0 +1,30 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 39407, "Picker doesn't reset to source selected index when closed while spinning, via touch outside or Done button.", PlatformAffected.iOS)]
public class Bugzilla39407 : TestContentPage
{
protected override void Init()
{
var picker = new Picker
{
ItemsSource = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }
};
Content = new StackLayout
{
Children =
{
picker
}
};
}
}
}

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

@ -584,6 +584,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38731.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla56710.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla52700.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39407.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">

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

@ -86,6 +86,11 @@ namespace Xamarin.Forms.Platform.iOS
void OnEnded(object sender, EventArgs eventArgs)
{
var s = (PickerSource)_picker.Model;
if (s.SelectedIndex != _picker.SelectedRowInComponent(0))
{
_picker.Select(s.SelectedIndex, 0, false);
}
ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}