protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            if (_showSearchButton != null)
            {
                _showSearchButton.Click -= SearchButton_Click;
            }

            if (_hideSearchButton != null)
            {
                _hideSearchButton.Click -= SearchButton_Click;
            }

            if (TryGetTemplatedChild(PART_ShowSearchButton, out _showSearchButton))
            {
                _showSearchButton.Click += SearchButton_Click;
            }

            if (TryGetTemplatedChild(PART_HideSearchButton, out _hideSearchButton))
            {
                _hideSearchButton.Click += SearchButton_Click;
            }

            _commandsFlyout = GetTemplatedChild <MenuFlyout>(PART_CommandsFlyout);
            _groupContent   = GetTemplatedChild <VisualStateGroup>(GROUP_CommonStates);
            _autoSuggestBox = GetTemplatedChild <AutoSuggestBox>(PART_SearchBox);

            _autoSuggestBox.TextChanged      += (s, e) => TextChanged?.Invoke(s, e);
            _autoSuggestBox.SuggestionChosen += (s, e) => SuggestionChoosen?.Invoke(s, e);
            _autoSuggestBox.QuerySubmitted   += (s, e) => QuerySubmitted?.Invoke(s, e);

            Update();
        }
示例#2
0
 private void SubmitQuery(string queryText, object chosenSuggestion)
 {
     QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs
     {
         QueryText        = queryText,
         ChosenSuggestion = chosenSuggestion
     });
 }
示例#3
0
        private void VisiblePath_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            QuerySubmitted?.Invoke(this, new ToolbarQuerySubmittedEventArgs()
            {
                QueryText = args.QueryText
            });

            (this as INavigationToolbar).IsEditModeEnabled = false;
        }
        private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.QueryText != string.Empty)
            {
                AddToken(args.QueryText);
                sender.Text = string.Empty;
                sender.Focus(FocusState.Programmatic);
            }

            QuerySubmitted?.Invoke(sender, args);
        }
示例#5
0
    protected void ShowResults(object sender, FlightQueryEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException(nameof(e));
        }
        mfbTotalSummary1.CustomRestriction = Restriction = e.Query;
        mvQuery.ActiveViewIndex            = 0; // go back to the results.
        UpdateDescription();

        QuerySubmitted?.Invoke(sender, e);
    }
示例#6
0
    protected void mfbQueryDescriptor1_QueryUpdated(object sender, FilterItemClickedEventArgs fic)
    {
        if (fic == null)
        {
            throw new ArgumentNullException(nameof(fic));
        }
        FlightQuery fq = Restriction.ClearRestriction(fic.FilterItem);

        ShowResults(sender, new FlightQueryEventArgs(fq));
        UpdateDescription();

        QuerySubmitted?.Invoke(sender, new FlightQueryEventArgs(fq));
    }
示例#7
0
    protected void DoSearch()
    {
        GetFlightQuery();

        // Save it, if it was given a name
        if (m_fq is CannedQuery cq && !String.IsNullOrEmpty(cq.QueryName))
        {
            cq.Commit();
            UpdateSavedQueries();
            txtQueryName.Text = string.Empty;
        }

        QuerySubmitted?.Invoke(this, new FlightQueryEventArgs(m_fq));
    }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoSuggestBox"/> class
        /// </summary>
        public AutoSuggestBox()
        {
            NativeAutoSuggestBox = new NativeAutoSuggestBox(

                Android.App.Application.Context

                );
            NativeAutoSuggestBox.SuggestionChosen += (s, e) => { SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(e.SelectedItem)); };
            NativeAutoSuggestBox.TextChanged      += (s, e) => {
                suppressTextChangedEvent = true;
                Text = NativeAutoSuggestBox.Text;
                suppressTextChangedEvent = false;
                TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs((AutoSuggestionBoxTextChangeReason)e.Reason));
            };
            NativeAutoSuggestBox.QuerySubmitted += (s, e) => QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(e.QueryText, e.ChosenSuggestion));
        }
        protected override void OnApplyTemplate()
        {
            _borderElement  = base.GetTemplateChild("BorderElement") as Border;
            _autoSuggestBox = base.GetTemplateChild("AutoSuggestBox") as AutoSuggestBox;
            _displayContent = base.GetTemplateChild("DisplayContent") as Border;

            _autoSuggestBox.TextChanged      += (s, a) => TextChanged?.Invoke(s, a);
            _autoSuggestBox.SuggestionChosen += (s, a) => SuggestionChosen?.Invoke(s, a);
            _autoSuggestBox.QuerySubmitted   += (s, a) => QuerySubmitted?.Invoke(s, a);

            _isInitialized = true;

            UpdateMode();
            UpdateVisualState();

            base.OnApplyTemplate();
        }
示例#10
0
        private async void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            QuerySubmitted?.Invoke(sender, args);

            if (args.ChosenSuggestion != null)
            {
                sender.Text = string.Empty;
                await AddToken(args.ChosenSuggestion);

                sender.Focus(FocusState.Programmatic);
            }
            else if (!string.IsNullOrWhiteSpace(args.QueryText))
            {
                sender.Text = string.Empty;
                await AddToken(args.QueryText);

                sender.Focus(FocusState.Programmatic);
            }
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoSuggestBox"/> class
        /// </summary>
        public AutoSuggestBox()
        {
#if !NETSTANDARD2_0
            NativeAutoSuggestBox = new NativeAutoSuggestBox(
#if __ANDROID__
                Android.App.Application.Context
#endif
                );
            NativeAutoSuggestBox.SuggestionChosen += (s, e) => { SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(e.SelectedItem)); };
            NativeAutoSuggestBox.TextChanged      += (s, e) => {
                suppressTextChangedEvent = true;
                Text = NativeAutoSuggestBox.Text;
                suppressTextChangedEvent = false;
                TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs((AutoSuggestionBoxTextChangeReason)e.Reason));
            };
            NativeAutoSuggestBox.QuerySubmitted += (s, e) => QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(e.QueryText, e.ChosenSuggestion));
#else
            throw new PlatformNotSupportedException();
#endif
        }
示例#12
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _container      = base.GetTemplateChild("container") as Grid;
            _autoSuggestBox = base.GetTemplateChild("autoSuggestBox") as AutoSuggestBox;
            _displayText    = base.GetTemplateChild("displayText") as TextBlock;
            _border         = base.GetTemplateChild("border") as Border;

            _container.PointerEntered += OnPointerEntered;
            _container.PointerExited  += OnPointerExited;

            _autoSuggestBox.GotFocus  += OnGotFocus;
            _autoSuggestBox.LostFocus += OnLostFocus;

            _autoSuggestBox.TextChanged      += (s, a) => TextChanged?.Invoke(s, a);
            _autoSuggestBox.SuggestionChosen += (s, a) => SuggestionChosen?.Invoke(s, a);
            _autoSuggestBox.QuerySubmitted   += (s, a) => QuerySubmitted?.Invoke(s, a);

            UpdateMode();
        }
示例#13
0
 private void SubmitSearch()
 {
     QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(null, Text));
     IsSuggestionListOpen = false;
 }
示例#14
0
 internal void RaiseQuerySubmitted(string queryText, object chosenSuggestion)
 {
     QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(queryText, chosenSuggestion));
 }
 internal void RaiseQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     QuerySubmitted?.Invoke(sender, args);
 }
示例#16
0
 private void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     QuerySubmitted?.Invoke(sender, args);
 }
示例#17
0
 private void SubmitSearch()
 {
     QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(_suggestionsList.SelectedItem, Text));
     IsSuggestionListOpen = false;
 }
 public void FireQuerySubmitted(AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     QuerySubmitted?.Invoke(this, args);
 }
示例#19
0
 public void OnQuerySubmitted(string queryParams)
 {
     QuerySubmitted?.Invoke(this, new QuerySubmittedEventArgs {
         QueryParams = queryParams
     });
 }
    protected void DoSearch()
    {
        GetFlightQuery();

        QuerySubmitted?.Invoke(this, new FlightQueryEventArgs(m_fq));
    }