Single selection w/both DisplayMemberPath and TextSearchPath

8 posts, 0 answers
  1. Rob
    Rob avatar
    11 posts
    Member since:
    Nov 2009

    Posted 09 Jul 2014 Link to this post

    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
  2. Rob
    Rob avatar
    11 posts
    Member since:
    Nov 2009

    Posted 09 Jul 2014 in reply to Rob Link to this post

    I'll add that I'm using version 2013.3.1316.45

  3. UI for WPF is Visual Studio 2017 Ready
  4. Rob
    Rob avatar
    11 posts
    Member since:
    Nov 2009

    Posted 09 Jul 2014 Link to this post

    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
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 11 Jul 2014 Link to this post

    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.

     
  6. Rob
    Rob avatar
    11 posts
    Member since:
    Nov 2009

    Posted 15 Jul 2014 in reply to Ves Link to this post

    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.
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 18 Jul 2014 Link to this post

    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.
     
  8. Rob
    Rob avatar
    11 posts
    Member since:
    Nov 2009

    Posted 22 Jul 2014 in reply to Vladi Link to this post

    Yes, sorry, we are using the WPF version. I picked the wrong section.

    Rob
  9. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 23 Jul 2014 Link to this post

    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.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready