示例#1
0
        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();
                }
            };
        }
示例#2
0
 private void CloseSearchButton_Click(object sender, RoutedEventArgs e) => HideSearchStoryboard.Begin();