diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41078.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41078.cs new file mode 100644 index 000000000..0c9153312 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41078.cs @@ -0,0 +1,36 @@ +using System; + +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System.Collections.Generic; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 41078, "[Win 8.1] ListView not visually setting the initial SelectedItem upon creation", PlatformAffected.WinRT)] + public class Bugzilla41078 : TestContentPage + { + protected override void Init() + { + var list = new List { 1, 2, 3 }; + var listView = new ListView + { + ItemsSource = list, + SelectedItem = list[1] + }; + Content = new StackLayout + { + Children = + { + new Label { Text = "The '2' cell should have a background color indicating it is selected" }, + listView + } + }; + } + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 2a8db8fb2..991270b66 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -104,6 +104,7 @@ + diff --git a/Xamarin.Forms.Platform.WinRT/ListViewRenderer.cs b/Xamarin.Forms.Platform.WinRT/ListViewRenderer.cs index bbd101fa1..d47299a47 100644 --- a/Xamarin.Forms.Platform.WinRT/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/ListViewRenderer.cs @@ -83,6 +83,12 @@ namespace Xamarin.Forms.Platform.WinRT // WinRT throws an exception if you set ItemsSource directly to a CVS, so bind it. List.DataContext = new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled }; +#if !WINDOWS_UWP + var selected = Element.SelectedItem; + if (selected != null) + OnElementItemSelected(null, new SelectedItemChangedEventArgs(selected)); +#endif + UpdateGrouping(); UpdateHeader(); UpdateFooter();