Comments (4)
I think GetFilters
is not flexible. It can be generalized to:
public virtual Func<object, double> Priority(string query, Func<object, string> text)
{
return item =>
{
if (filter1(query, text)(item)) return 0;
if (filter2(query, text)(item)) return 1;
return double.MaxValue;
};
}
I'm facing a problem that there is no way to sort Items
, the backing collection of the dropdown list, with an arbitrary comparer. We need to sort items by properties with default comparers; or sort ItemsSource
instead. So there are two options:
- (A) Sort items by a property. Update the property's value as necessary for ordering.
- (B) Ask users to provide a command to sort
ItemsSource
.
I don't choose (A) because it's inefficient and difficult to use. I have hesitation in implementing (B). Hmm...
from dotnetkit.wpf.autocompletecombobox.
Hello. Your suggestion looks good! Thank you.
from dotnetkit.wpf.autocompletecombobox.
Take a look:
public virtual Func<object, bool> GetFilter(string query, Func<object, string> stringFromItem)
{
return item =>
//! Filter one
stringFromItem(item).IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0 ||
//! Filter two
stringFromItem(item).IndexOf(Transliteration.LatinToCyrillyc(query, Language.Russian),
StringComparison.OrdinalIgnoreCase) >= 0;
}
Here we got 2 filters.
Replacing Func<object, bool> GetFilter
with List<Func<object, bool>> GetFilters
gives us possibility to order results by filters.
from dotnetkit.wpf.autocompletecombobox.
I'm sorry, but I can't dig deep into AutoCompleteComboBox
mechanics and help with this feature right now.
from dotnetkit.wpf.autocompletecombobox.
Related Issues (20)
- ItemsSource is incorrect when changing text search for filtering HOT 1
- Add Url to nuspec HOT 1
- Lastest nuget version doesn't contain the latest fix HOT 2
- dynamically load items HOT 2
- up&down issue HOT 4
- Multiple selectetion? HOT 1
- Item selection in ComboBox breaks if DisplayMemberPath and TextSearch.TextPath point to different properties HOT 2
- Don't show empty list HOT 2
- Pass the enter key event somehow? HOT 2
- Support .NET 4.0 HOT 1
- MaxSuggestionCount HOT 3
- Strong name assembly HOT 5
- Drop down list always displayed? HOT 3
- Changing ItemsSource selects the first item HOT 1
- Feature offer: transliteration support HOT 1
- Winforms HOT 2
- Focus issue (cursor won't "blink") HOT 6
- downloaded code, compiled and ran it. Couldn't get it to work At All. Depending on what is typed the combo either shows all the names or none of them. HOT 2
- Don't select item on key down/up HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnetkit.wpf.autocompletecombobox.