/// <summary> /// Retrieves a defined predicate filter through a new AutoCompleteBox /// control instance. /// </summary> /// <param name="mode">The FilterMode of interest.</param> /// <returns>Returns the predicate instance.</returns> private static AutoCompleteFilterPredicate <string> GetFilter(AutoCompleteFilterMode mode) { return(new AutoCompleteBox { FilterMode = mode } .TextFilter); }
/// <summary> /// Defines filter mode. /// </summary> /// <example> /// <code lang="CS"> /// <%= Html.Telerik().ComboBox() /// .Name("ComboBox") /// .Filterable(filtering => /// { /// filtering.FilterMode(AutoCompleteFilterMode.StartsWith); /// }) /// %> /// </code> /// </example> public AutoCompleteFilterSettingsBuilder FilterMode(AutoCompleteFilterMode filtering) { Guard.IsNotNull(filtering, "filtering"); settings.FilterMode = filtering; return this; }
/// <summary> /// Defines filter mode. /// </summary> /// <example> /// <code lang="CS"> /// <%= Html.Telerik().ComboBox() /// .Name("ComboBox") /// .Filterable(filtering => /// { /// filtering.FilterMode(AutoCompleteFilterMode.StartsWith); /// }) /// %> /// </code> /// </example> public AutoCompleteFilterSettingsBuilder FilterMode(AutoCompleteFilterMode filtering) { Guard.IsNotNull(filtering, "filtering"); settings.FilterMode = filtering; return(this); }
/// <summary> /// Defines filter mode. /// </summary> /// <example> /// <code lang="CS"> /// <%= Html.Telerik().ComboBox() /// .Name("ComboBox") /// .Filterable(filtering => /// { /// filtering.FilterMode(AutoCompleteFilterMode.StartsWith); /// }) /// %> /// </code> /// </example> public ComboBoxFilterSettingsBuilder FilterMode(AutoCompleteFilterMode filtering) { Guard.IsNotNull(filtering, "filtering"); settings.Enabled = true; settings.FilterMode = filtering; return this; }
/// <summary> /// Called when the template's tree is generated. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); var toggle = (ToggleButton)GetTemplateChild("PopupToggleButton"); toggle.Click += DropDownToggle_Click; var lb = (ListBox)GetTemplateChild("Selector"); lb.DisplayMemberPath = DisplayMemberPath; _holdFilterMode = FilterMode; TextChanged += AutoCompleteComboBox_TextChanged; SelectionChanged += new SelectionChangedEventHandler(AutoCompleteComboBox_SelectionChanged); }
private void DropDownToggle_Click(object sender, RoutedEventArgs e) { IsDropDownOpen = !IsDropDownOpen; if (ToggleButtonClick != null) { ToggleButtonClick(this, e); } if (IsDropDownOpen) { _holdFilterMode = FilterMode; FilterMode = AutoCompleteFilterMode.None; ((TextBox)GetTemplateChild("Text")).SelectAll(); } Focus(); }
/// <summary> /// Index function that retrieves the filter for the provided /// AutoCompleteFilterMode. /// </summary> /// <param name="FilterMode">The built-in search mode.</param> /// <returns>Returns the string-based comparison function.</returns> public static AutoCompleteFilterPredicate<string> GetFilter(AutoCompleteFilterMode FilterMode) { switch (FilterMode) { case AutoCompleteFilterMode.Contains: return Contains; case AutoCompleteFilterMode.ContainsCaseSensitive: return ContainsCaseSensitive; case AutoCompleteFilterMode.ContainsOrdinal: return ContainsOrdinal; case AutoCompleteFilterMode.ContainsOrdinalCaseSensitive: return ContainsOrdinalCaseSensitive; case AutoCompleteFilterMode.Equals: return Equals; case AutoCompleteFilterMode.EqualsCaseSensitive: return EqualsCaseSensitive; case AutoCompleteFilterMode.EqualsOrdinal: return EqualsOrdinal; case AutoCompleteFilterMode.EqualsOrdinalCaseSensitive: return EqualsOrdinalCaseSensitive; case AutoCompleteFilterMode.StartsWith: return StartsWith; case AutoCompleteFilterMode.StartsWithCaseSensitive: return StartsWithCaseSensitive; case AutoCompleteFilterMode.StartsWithOrdinal: return StartsWithOrdinal; case AutoCompleteFilterMode.StartsWithOrdinalCaseSensitive: return StartsWithOrdinalCaseSensitive; case AutoCompleteFilterMode.None: case AutoCompleteFilterMode.Custom: default: return null; } }
/// <summary> /// Index function that retrieves the filter for the provided /// AutoCompleteFilterMode. /// </summary> /// <param name="FilterMode">The built-in search mode.</param> /// <returns>Returns the string-based comparison function.</returns> public static AutoCompleteFilterPredicate <string> GetFilter(AutoCompleteFilterMode FilterMode) { switch (FilterMode) { case AutoCompleteFilterMode.Contains: return(Contains); case AutoCompleteFilterMode.ContainsCaseSensitive: return(ContainsCaseSensitive); case AutoCompleteFilterMode.ContainsOrdinal: return(ContainsOrdinal); case AutoCompleteFilterMode.ContainsOrdinalCaseSensitive: return(ContainsOrdinalCaseSensitive); case AutoCompleteFilterMode.Equals: return(Equals); case AutoCompleteFilterMode.EqualsCaseSensitive: return(EqualsCaseSensitive); case AutoCompleteFilterMode.EqualsOrdinal: return(EqualsOrdinal); case AutoCompleteFilterMode.EqualsOrdinalCaseSensitive: return(EqualsOrdinalCaseSensitive); case AutoCompleteFilterMode.StartsWith: return(StartsWith); case AutoCompleteFilterMode.StartsWithCaseSensitive: return(StartsWithCaseSensitive); case AutoCompleteFilterMode.StartsWithOrdinal: return(StartsWithOrdinal); case AutoCompleteFilterMode.StartsWithOrdinalCaseSensitive: return(StartsWithOrdinalCaseSensitive); case AutoCompleteFilterMode.None: case AutoCompleteFilterMode.Custom: default: return(null); } }
/// <summary> /// Retrieves a defined predicate filter through a new AutoCompleteBox /// control instance. /// </summary> /// <param name="mode">The FilterMode of interest.</param> /// <returns>Returns the predicate instance.</returns> private static AutoCompleteFilterPredicate<string> GetFilter(AutoCompleteFilterMode mode) { return new AutoCompleteBox { FilterMode = mode } .TextFilter; }
private void SelectFilter(AutoCompleteFilterMode mode) { switch (mode) { case AutoCompleteFilterMode.None: this._filterMode = AutoCompleteFilterMode.None; this._filter = None; break; case AutoCompleteFilterMode.StartsWith: this._filterMode = AutoCompleteFilterMode.StartsWith; this._filter = StartsWith; break; case AutoCompleteFilterMode.StartsWithCaseSensitive: this._filterMode = AutoCompleteFilterMode.StartsWithCaseSensitive; this._filter = StartsWithCaseSensitive; break; case AutoCompleteFilterMode.StartsWithOrdinal: this._filterMode = AutoCompleteFilterMode.StartsWithOrdinal; this._filter = StartsWithOrdinal; break; case AutoCompleteFilterMode.StartsWithOrdinalCaseSensitive: this._filterMode = AutoCompleteFilterMode.StartsWithOrdinalCaseSensitive; this._filter = StartsWithOrdinalCaseSensitive; break; case AutoCompleteFilterMode.Contains: this._filterMode = AutoCompleteFilterMode.Contains; this._filter = Contains; break; case AutoCompleteFilterMode.ContainsCaseSensitive: this._filterMode = AutoCompleteFilterMode.ContainsCaseSensitive; this._filter = ContainsCaseSensitive; break; case AutoCompleteFilterMode.ContainsOrdinal: this._filterMode = AutoCompleteFilterMode.ContainsOrdinal; this._filter = ContainsOrdinal; break; case AutoCompleteFilterMode.ContainsOrdinalCaseSensitive: this._filterMode = AutoCompleteFilterMode.ContainsOrdinalCaseSensitive; this._filter = ContainsOrdinalCaseSensitive; break; case AutoCompleteFilterMode.Equals: this._filterMode = AutoCompleteFilterMode.Equals; this._filter = Equals; break; case AutoCompleteFilterMode.EqualsCaseSensitive: this._filterMode = AutoCompleteFilterMode.EqualsCaseSensitive; this._filter = EqualsCaseSensitive; break; case AutoCompleteFilterMode.EqualsOrdinal: this._filterMode = AutoCompleteFilterMode.EqualsOrdinal; this._filter = EqualsOrdinal; break; case AutoCompleteFilterMode.EqualsOrdinalCaseSensitive: this._filterMode = AutoCompleteFilterMode.EqualsOrdinalCaseSensitive; this._filter = EqualsOrdinalCaseSensitive; break; case AutoCompleteFilterMode.Custom: this._filterMode = AutoCompleteFilterMode.Custom; this._filter = Custom; break; default: throw new ArgumentException("Filters can't be combined."); } }