Extended AutoCompleteBox sample updated to Silverlight 3

A while back I had a sample that extends AutoCompleteBox which worked in Silverlight 2. Here is the sample upgraded to Silverlight 3. I did not add/remove anything functional. just fixed the errors that are caused by the changes in base class(AutoCompleteBox)

you can try a sample here and download the code here

Advertisements

30 thoughts on “Extended AutoCompleteBox sample updated to Silverlight 3

  1. Hi Lee,
    Thank for the control. It is great.
    For some reason when add the code to my project and use the control on navigation page, the textbox is not showing up. Do you see any reason why this could happen.
    I am on Silverlight 3 and working in in RIA Business Application Page.

    1. I am not sure why it is doing that, did you specify width for the control. can you reproduce the same behaviour outside your project.

  2. Yes, I Tried.

    I Created new Silverlight Business application from template.
    Copied your code files. In home page, I cut and pasted your code for control and button then Added resources.

    In code behind i linked the data.

    The button below the control shows up. But not the Extended AutoComplete TextBox.

    If i just open your code sample as is (from zip), it works fine.

    Thanks
    Vee

    1. Hi,
      In her case themes folder was missing. I suggested the following and vee got it to work

      you need to add “themes” folder and create a generic.xaml in that folder, like in the sample which will have the template for the control. the Control picks uip the template from there.
      right now, the template is not getting applied so it is silently failing

  3. I have another issue. I have the ExtAutoCompleteBox calling a web service that returns data from Active Directory. The web service returns data like ‘displayname|mail|samaccountname’. In the Populating event, I parse through that data and put it each record in an object and make the ItemsSource a List of those objects. Now, I want to display only one member of the selected object. In the basic AutoCompleteBox, I would use the ValueMemberBinding. With the ExtACB, it just shows the type of the object in the List as what is selected. Can you tell from this what I am doing wrong?

    1. I did find one thing. In ExtAutoCompleteBox.cs, the OnSelectionChanged() has this line:

      previtem = e.AddedItems[0].ToString()

      This is what makes my object a string and just shows the type. Now, I do set the ValueMemberBinding property, but when I debug this, it is not set.

      1. Hi,
        There will be quite a few changes need to get all the way there.
        Instead of displaying just strings. one way is to provide for a DataTemplate so we can specify what gets displayed. then we need to provide a way to get the selected items returned as objects instead of strings etc
        here is a sample where I added a datatemplate and changed the templates of the controls so the template is picked up.
        http://cid-71b364b59919d1e8.skydrive.live.com/self.aspx/silverlight%203%20files/updated%20ExtAcb.zip

  4. I have it working quite well now. But there is one more thing I’d like to do. Have the dropdown of the AutoCompleteBox display a datagrid. I’ve tried a couple times never getting it right. Any pointers?

    1. I believe there is a ItemsControl in the template of the AutoCompleteBox, you can replace that with datagrid. you can check one of the posts where I did something similar(Datagrid in ComboBox)

  5. Have you came across or seen this in WPF anywhere. I am looking to do the exact thing in WPF, but couldn’t quite get this one working right.

  6. This looks great. Can we have this functionality with the dropdown (toogle button which displays all item in dropdown) with checkbox templates , so user either can filter to select OR toggle and select?

    I tried this with chnaging the template, when I add the checkboxes, filter doesnt work.
    Any help would be appreciated !

      1. Yes, Multiselection with autocompletebox behaviour ..somethink I shall be able to add the checkboxes where user either can click on toggle button to see all items to select OR type it to see based on autocomplete filter and select those..

        1. Hi,
          There is a sample floating around that shows how to use AutoCompleteBox as filterable combobox. I would start with that

  7. Hi Lee,
    Thanks for nice and neat implementation.

    I’m facing one problem with number of items I can add/select , existing control does only allow to select items of initial length of textbox (for example say width=100 ) .Is it possible to add scroll view and add more items (Just like textbox when we type characters to the textbox it automatcially scrolls the view for you).I would appreciate if you share some samples with this implementation.

    Thanks,
    BAIJUMAX

  8. @baijumax, I needed a similiar function, so I dropped in a horizontal list box with a wrap panel to display the items. So when you run out of horizontal space, it wraps around to the next row.

    1. Thanks Greg.Actually Lee shared code for adding scroll viewer,but my clients didn’t like it in the data entry form.So I have modified microsoft autocomplete box source code to support multiple items separated by comma (or a delimiter).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s