Applying a display template to autocomplete textbox

2 posts, 1 answers
  1. Arun
    Arun avatar
    1 posts
    Member since:
    Feb 2013

    Posted 21 Jul 2015 Link to this post

    I am using the RadAutoCompleteBox for getting the user input.

    i can also see the DropDownItemTemplate (which is used to put a template to the dropdownitems shown)...but I can't see/find anywhere a way to use a data template for the textbox ...after the users have made a selection.

     so for example... the drop down displays (Value : Display Name) and when the selection happens on the display name is shown...but i want to display the entire thing in the autocomplete textbox...

     is there any way i can acheieve this.

     

    thanks and regards,

    arun

  2. Answer
    Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 21 Jul 2015 Link to this post

    Hello Arun,

    In order to apply the exact same appearance for the items as the one in the DropDown as soon as a selection is made you need to apply a custom BoxesItemTemplate -  it is used to customize the way the items are rendered in the TextBox part of the control. We have created a sample project hat demonstrates how to apply such a Template and you could run and evaluate it. Please, notice that the BoxesItemTemplate is applied only whenever the control is in Multiple selection mode. If you are using Single selection mode the only approach that we could suggest you to achieve the desired is to override the ToString method of the custom class you use as a source for RadAutoCompleteBox.

    By the end of the week we will add an article in our help documentation and an SDK example providing more detailed information about creating and applying BoxesItemTemplate.

    Hopes this helps.

    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top