This is a migrated thread and some comments may be shown as answers.

Single selection w/both DisplayMemberPath and TextSearchPath

7 Answers 198 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 10 Jul 2014, 12:40 AM
In SelectionMode of Single, what I want is to search on one property but show another when it is selected.

Using the First look example code, the TextSearchPath is Title. DisplayMemberPath is not set. 

I added a property to Song:

        public string SearchText
        {
            get
            {
                return string.Format("{0}, {1}", this.title, this.author);
            }
        }

I want to search on both title and author. So I changed TextSearchPath to SearchText.
What I want to show when selected is Title, so I added DisplayMemeberPath to Title. This does not work. It still shows the SearchText property when selected. 

Is this a bug, limitation, or something I can work around?

Rob

7 Answers, 1 is accepted

Sort by
0
Rob
Top achievements
Rank 1
answered on 10 Jul 2014, 12:43 AM
I'll add that I'm using version 2013.3.1316.45

0
Rob
Top achievements
Rank 1
answered on 10 Jul 2014, 02:06 AM
Not that I don't want an answer, but I figured out a workaround.

If I pre-search, and set ItemSource to a filtered list, then I can just use DisplayMemberPath to what I want to show, and use a FilteringBehavior that just returns the whole list.

Rob
0
Ves
Telerik team
answered on 11 Jul 2014, 11:37 AM
Hi Rob,

You should be able to obtain the desired result with FilterMemberPath = "SearchText" and DisplayMemberPath = "Title". Please, find attached a small example, which follows your description. It has been tested against  version 2013.3.1320.45 (the official 2013 Q3 SP2 release) and against the latest version (2014.2.617.45).

Best regards,
Ves
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rob
Top achievements
Rank 1
answered on 15 Jul 2014, 11:57 PM
I guess we need to update since you have tested it against a newer build. The version I'm using is 2013.3.1316.45 and does not contain the property FilterMemberPath. The help page (http://www.telerik.com/help/wpf/radautocompletebox-features-key-properties.html) mentions using DisplayMemberPath and TextSearchPath together.

Also, in your MainPage.xaml, you didn't didn't select Single for SelectionMode. It worked in Multiple mode, just not in single mode.
0
Vladi
Telerik team
answered on 18 Jul 2014, 06:40 AM
Hello Rob,

As the original post was posted in the "UI for Windows 8 XAML Forum / AutoCompleteBox for XAML" section and the link from your last post was for the WPF version of the AutoCompleteBox could you verify which platform you are using, Windows 8 or WPF?

If you are using the Windows 8 version the mentioned approach by Ves should work as expected. If you are using the WPF version of RadAutoCompleteBox note that the approach described earlier is not possible. In that case as you mentioned you could use a custom FilteringBehavior and override its FindMatchingItems method in order to implement a custom filtering by a different property of the objects.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Rob
Top achievements
Rank 1
answered on 22 Jul 2014, 01:03 PM
Yes, sorry, we are using the WPF version. I picked the wrong section.

Rob
0
Vladi
Telerik team
answered on 23 Jul 2014, 11:39 AM
Hello Rob,

In that case as previously described you could use a custom FilteringBehavior in order to achieve the desired behavior in the RadAutoCompleteBox control.

I have moved the thread to the correct WPF forum section.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
AutoCompleteBox
Asked by
Rob
Top achievements
Rank 1
Answers by
Rob
Top achievements
Rank 1
Ves
Telerik team
Vladi
Telerik team
Share this question
or