private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) { AddToken(args.SelectedItem); sender.Text = string.Empty; sender.Focus(FocusState.Programmatic); SuggestionChosen?.Invoke(sender, args); }
private void ChoseItem(Object o) { if (UpdateTextOnSelect) { UpdateTextFromSuggestion(o); } SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(o)); }
private void OnSuggestionListItemClick(object sender, ItemClickEventArgs e) { if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().Debug($"Suggestion item clicked {e.ClickedItem}"); } SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(e.ClickedItem)); IsSuggestionListOpen = false; }
/// <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(); }
/// <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 OnSuggestionsListSelectionChanged(object sender, SelectionChangedEventArgs e) { if (m_ignoreSelectionChange) { return; } if (IsSuggestionListOpen) { var selectedItem = m_suggestionsList.SelectedItem; if (selectedItem != null) { m_suggestionsList.ScrollIntoView(selectedItem); SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs { SelectedItem = selectedItem }); if (UpdateTextOnSelect) { var selectedValue = m_suggestionsList.SelectedValue; if (selectedValue != null) { UpdateTextValue(selectedValue.ToString(), AutoSuggestionBoxTextChangeReason.SuggestionChosen); } } } else { m_suggestionsList.ScrollToTop(); UpdateTextValue(m_searchText); } if (m_textBox != null) { m_textBox.CaretIndex = m_textBox.Text.Length; } } }
internal void RaiseSuggestionChosen(object selectedItem) { SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(selectedItem)); }
internal void RaiseSuggestionChosen(object selectedItem) { SuggestionChosen?.Invoke(this, new AutoCompleteViewEventArgs(selectedItem)); }
internal void RaiseSuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) { SuggestionChosen?.Invoke(sender, args); }
public void FireSuggestionChosen(AutoSuggestBoxSuggestionChosenEventArgs args) { SuggestionChosen?.Invoke(this, args); }
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) { SuggestionChosen?.Invoke(sender, args); }