public MainPage() { InitializeComponent(); _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; NavigationCacheMode = NavigationCacheMode.Enabled; ItemGridView.SelectionChanged += (s, e) => { foreach (object item in e.AddedItems) { SelectionViewModel.Items.Add(item as ItemViewModel); } foreach (object item in e.RemovedItems) { SelectionViewModel.Items.Remove(item as ItemViewModel); } }; ShowSearchStoryboard.Completed += (s, e) => { _isSearchVisible = true; searchBox.Focus(FocusState.Programmatic); }; ShowSearchResultsStoryboard.Completed += (s, e) => ((MainPivot.SelectedItem as PivotItem).Content as AdaptiveGridView).Focus(FocusState.Programmatic); HideSearchStoryboard.Completed += (s, e) => _isSearchVisible = false; ViewModel.CurrentSearchProperties.SearchCanceled += (s, e) => { if (_isSearchVisible) { HideSearchStoryboard.Begin(); } }; }
private void CloseSearchButton_Click(object sender, RoutedEventArgs e) => HideSearchStoryboard.Begin();