Home > Silverlight > DataGrid in ComboBox

DataGrid in ComboBox

We all know how to use the ComboBox, bind it to a collection and set DisplayMemberPath and we are done

we get a nice looking ComboBox

we can make it look like this with few tweaks (yes, DataGrid with all the functionality in the popup)

Download the code here

if you did not already leave the site, I am still looking for a job either in WPF or Silverlight, please let me know

Categories: Silverlight
  1. Bruce Denham
    October 16, 2008 at 9:34 pm | #1

    Hey Lee,
    Got any clues for creating a true ComboBox in which the items can be editabled? Maybe a ComboBox that can host a TextBox AND a DropDownList so that you could enter a name (ad hoc) into the combobox or select from the lists in the ItemSource.

    I’m working on this now. Thought I might ping you to see if you got any ideas.

    Great site, man.

    Thanks,
    Bruce

  2. lee
    October 17, 2008 at 1:41 am | #2

    I am waiting for the release version. if the feature is not there in the release version. then I might take a shot at it. I would say we have to inherit from the ComboBox and change the template.

  3. Bruce Denham
    October 17, 2008 at 2:52 pm | #3

    Yeah, that sounds good. Thanks.

  4. Hema
    March 18, 2009 at 8:01 am | #4

    Can you help me how to make the combobox editable when combobox has DataGrid.I want to Edit the
    Combobox so that i can
    add new item by editing in the combobox instead of
    going to the last row in the DataGrid if my DataGrid Contains so many items.

  5. June 10, 2009 at 7:39 am | #12

    i am hau giang
    i live in vietnam
    i already download code come back home. But i can not use
    i hope, you will send me another code

    • Ashok
      August 18, 2009 at 4:26 am | #13

      Lee,

      Could you make this work with data loading from Web Service using LINQ to SQL Classes?

      I am having error on the line
      popup = (visualTreeHelper.GetChild…..
      during runtime.
      NullReferenceException was unhandled by user code.

      I ma new to C#.

  1. October 7, 2008 at 9:29 am | #1