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(); }
private void SubmitQuery(string queryText, object chosenSuggestion) { QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs { QueryText = queryText, ChosenSuggestion = chosenSuggestion }); }
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); }
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); }
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)); }
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)); }
/// <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(); }
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); } }
/// <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 }
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(); }
private void SubmitSearch() { QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(null, Text)); IsSuggestionListOpen = false; }
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); }
private void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { QuerySubmitted?.Invoke(sender, args); }
private void SubmitSearch() { QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(_suggestionsList.SelectedItem, Text)); IsSuggestionListOpen = false; }
public void FireQuerySubmitted(AutoSuggestBoxQuerySubmittedEventArgs args) { QuerySubmitted?.Invoke(this, args); }
public void OnQuerySubmitted(string queryParams) { QuerySubmitted?.Invoke(this, new QuerySubmittedEventArgs { QueryParams = queryParams }); }
protected void DoSearch() { GetFlightQuery(); QuerySubmitted?.Invoke(this, new FlightQueryEventArgs(m_fq)); }