예제 #1
0
        public static void ShowPopup()
        {
            DialogService dialogService = new DialogService();

            dialogService.AnimationType      = DialogService.AnimationTypes.None;
            dialogService.AnimationTypeChild = DialogService.AnimationTypes.SlideInversed;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            dialogService.BackgroundBrush = (Brush)solidColorBrush;
            int num = 1;

            dialogService.ShowOnFrame = num != 0;
            SearchHintsUC._flyout     = dialogService;
            if (SearchHintsUC._viewModel == null || SearchHintsUC._isReloadScheduled)
            {
                SearchHintsUC._isReloadScheduled = false;
                SearchHintsSearchDataProvider.Reset();
                SearchHintsUC._viewModel = new GenericSearchViewModel <SearchHint, SearchHintHeader>((ISearchDataProvider <SearchHint, SearchHintHeader>) new SearchHintsSearchDataProvider());
                SearchHintsUC._viewModel.LoadData(true, false, true, false, true);
            }
            SearchHintsUC searchHintsUc = new SearchHintsUC();
            GenericCollectionViewModel2 <VKList <SearchHint>, SearchHintHeader> searchVm = SearchHintsUC._viewModel.SearchVM;

            ((FrameworkElement)searchHintsUc).DataContext = searchVm;
            searchHintsUc.searchTextBox.Text = (SearchHintsUC._viewModel.SearchString ?? "");
            SearchHintsUC uc = searchHintsUc;

            ((UIElement)uc.textBlockWatermarkText).Opacity = (string.IsNullOrEmpty(uc.searchTextBox.Text) ? 1.0 : 0.0);
            SearchHintsUC._flyout.Child   = (FrameworkElement)uc;
            SearchHintsUC._flyout.Opened += (EventHandler)((sender, args) => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (!string.IsNullOrWhiteSpace(uc.searchTextBox.Text))
                {
                    return;
                }
                ((Control)uc.searchTextBox).Focus();
            })));
            SearchHintsUC._flyout.Closed += (EventHandler)((sender, args) => ((FrameworkElement)uc).DataContext = null);
            SearchHintsUC._flyout.Show(null);
        }
예제 #2
0
 private void Search_OnClicked(object sender, System.Windows.Input.GestureEventArgs e)
 {
     SearchHintsUC.ShowPopup();
 }