MahApps.Metro
MahApps.Metro copied to clipboard
Request: new Control - AutoCompleteBox
I think, it will be nice to have here AutoCompleteBox like in WPF Toolkit (with SelectedItem, Delay, FilterMode) and all others features, combining with watermark, FloatingWatermark, etc, to keep same style everywhere... What do you think, it's possible?
Should we go for something close to the AutoCompleteBox of WPF Toolkit or close to the UWP AutoSuggestBox?
@Evangelink Thanks for the reply. In my opinion we need use best things from both of them:
- ItemsSource, ItemsTemplate, SelectedItem, FilterMode, CustomFilter, FilterDelay and add what is best in Mahapps:
- Watermark, FloatingWatermark, Icon, etc.
Is it necessary to make a new control or can we add this functionality through attached properties? After all, an AutoCompleteBox/AutoSuggestBox is just a glorified TextBox.
I would like to add some thoughts on this topic as I find it not to be trivial: I think there should be two controls instead of just one, serving different scenarios:
- In the first case the context is to select a single item from a collection of items (e.g. some sort of ID). The user can start to type and a popup shows up narrowing down the items shown based on some search / filter algorithm. The input is not complete as long as the user has selected one of the items either via clicking on an item in the popup (keyboard support should be there, too) or by typing the exact same string of one of the items. I would call this control
AutoCompleteBoxand its basically aComboBoxin non-edit mode (and thus it should also derive fromSelectorand use its given properties). I've already tried to adopt the existing WPF Combo Box for this purpose but I couldn't get it to work (can't override the popup logic). - The second case is to type free text (e.g. an email address). When the user starts to type the popup shows up suggesting existing email addresses, but the user is not bound to choose one of those. I would call this
AutoSuggestBoxand it basically derives fromTextBoxorTextBoxBase(or maybe we could also solve this issue with a newTextBoxtemplate and some attached properties).
Anyway, here are some issues that we have in both cases:
- We should allow different combinations of filtering, e.g. Starts with, Ends With, Contains, Wildcards, Ignore capitalization, or Ignore certain characters - just to name a few
- There should be an option to completely turn off filtering e.g. when the user wants to filter in the view model or in code-behind
- What do we do if the items are not strings? Introduce something like a
SearchMemberPathwhich works similar toDisplayMemberPath? What do we do if the user does not specify this property? CallToStringon every item?
I would like to contribute these controls to the project - what's your opinion on these thoughts?
In my case I use it only as an pop up - it means that it suggest but without obligation to select it (like textbox, but with validation - is empty or not). Filtering combinations are important. I use it also for an objects (DisplayMemberPath) together with validation (item is an object or not). So what I missing in wpfToolkit AutoCompleteBox is MahApps features (watermarks, etc.). That's why I was asking about control - to look the same with other MahApps controls.