Skip to content

Commit

Permalink
Fix issue when searching on icons page with item being selected (#1515)
Browse files Browse the repository at this point in the history
## Description
<!--- Describe your changes in detail -->
Closes #1500
  • Loading branch information
marcelwgn authored and karkarl committed Jul 15, 2024
1 parent 8e98723 commit 96b7a4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion WinUIGallery/ControlPages/DesignGuidance/IconsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
xmlns:controls="using:WinUIGallery.Controls"
xmlns:controls1="using:WinUIGallery.DesktopWap.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:WinUIGallery"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
Expand Down
8 changes: 6 additions & 2 deletions WinUIGallery/ControlPages/DesignGuidance/IconsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ public void Filter(string search)

private void IconsItemsView_SelectionChanged(ItemsView sender, ItemsViewSelectionChangedEventArgs args)
{
if (IconsItemsView.CurrentItemIndex != -1)
if (IconsItemsView.ItemsSource is IList<IconData> currentItems)
{
SelectedItem = (IconsItemsView.ItemsSource as IList<IconData>)[IconsItemsView.CurrentItemIndex];
if (IconsItemsView.CurrentItemIndex != -1 && IconsItemsView.CurrentItemIndex < currentItems.Count)
{
SelectedItem = currentItems[IconsItemsView.CurrentItemIndex];
}

}
}
}
Expand Down

0 comments on commit 96b7a4a

Please sign in to comment.