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

Databind to the (typed) Text of AutoCompleteBox

1 Answer 104 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Gyula
Top achievements
Rank 1
Gyula asked on 16 Nov 2012, 06:44 PM
Hi,

I'm trying to mimic the autocomplete behavior of Excel in a GridView. For this, I have DataBoundColumns, and replaced the CellEditTemplate with an AutoCompleteBox (ACB).
<telerik:GridViewDataColumn DataMemberBinding="{Binding ItemContent}">
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <telerik:RadAutoCompleteBox
                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView, AncestorLevel=1}, Path=DataContext.ListOfItemContent}"
        />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>

The not-so-simple ACB ItemsSource binding is for an MVVM approach, trying to reach the VM for the GridView.
My questions:
  • Is there an easier way to do this? (for example, the ComboBoxColumn has ItemsSource and ItemsSourceBinding)
  • What is the "Text" property for an ACB? (Can't find one, and the on-line documentation is a bit scarce for this control...)
  • Could you make a new GridColumn type, that would use /inherit from/ ACB? (like the special ones you already have)

According to this thread, the Text property would be the SearchText property, and it has some issues:

http://www.telerik.com/community/forums/wpf/autocompletebox/setting-the-searchtext.aspx
I can reproduce the same exception with the above code. The ListOfItemContent is the list of strings in the current column. It's in the VM.

public IEnumerable<string> ListOfItemContent
{
  get
  {
    return
      (from i in this.MyBusinessObjects
      select i.ItemContent).Distinct();
  }
}

Thank you,
Gyula

1 Answer, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 22 Nov 2012, 08:05 AM
Hi Gyula,

I would suggest you to use the SearchText property of the RadAutoCompleteBox. As you mentioned it had an issue into the Q3 2012 official release. However this issue is fixed into the latest internal build. The next official release that will include this fix is the Q3 SP1 and it will be released into the upcoming weeks.

We will consider adding such a column into the RadGridView for one of the future versions of the control. In the meantime you can create a custom column type. More about this you can read into our online help and blogs.

Kind regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
AutoCompleteBox
Asked by
Gyula
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Share this question
or