This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Jason, I know you're a busy guy, but I figured it doesn't hurt to ask. Is it possible the AutoCompleteBox SuggestionList source could be a list of objects with a path to the string field, instead of a list of strings? I populate my suggestion list from database entities. Currently, I just create a list of strings for the text field in the entities. However, when the user selects an item from the list, I'd like to know exactly which entity they selected as some of the text fields may hold the same value. I'm trying to figure out how to get the database ID for the item they chose from the list. |
|
|
Hi Chris, Sorry, we don't have time to implement this right now. The best workaround I can come up with is for your suggestion source to be strings that contain both the value, and the database ID in some format that you can parse, e.g. Value|ID. Then create a custom AutoCompleteBox style which uses a drop down item template to only display the values. You can probably continue using whatever SuggestionSource you're currently using. The slightly tricky part may be changing what's displayed in the text box itself, as that will include the full suggestion string. Your custom style could have a TextBox binding to the Text property, and use a converter to strip out the database ID, rather than using the usual PART_ContentHost that TextBox templates use. Note I have note tried all this. Hope it helps, let me know if you have further questions. -Jason Fauchelle |
|
|
Thanks Jason, I know it's not a trivial task, I tried extending the control myself to support this and finally said whoah, forget that. I already had implemented your suggestion above as a temp work around so thanks, great minds, this will get me by for now. Another question/problem... If I start typing from my autocompletebox and the drop down appears... I can't immediately use my mouse to select an item from this list. The click just closes the drop down. If I first arrow key down once, so that an item in the drop down has focus, I can then wheel mouse scroll and click to select an item properly. I'm on the June 1 2015 nightly of elements. |
|
|
Hmmmm maybe scratch my last question. Setting IsSuggestionListExclusive="False" instead of "True" makes the mouse click on the dropdown work, maybe I just don't understand this property's intended use? EDIT: This is the thread that lead me to focus problems and the IsSuggestionListExclusive property: Some problems with AutoCompleteBox |
|
|
Hi Chris, Thanks for reporting this. This is an issue which I've resolved for the next nightly build. Clicking an item from the list box will now work correctly. IsSuggestionListExclusive set to true means that when the AutoCompleteBox loses focus, it forces the value to always be one of the suggestion values. Set to false allows the user to input anything they want. Let me know if you have further questions about this. -Jason Fauchelle |
|
|
Thanks for the quick response Jason. |
|