ComboBox in DataGrid Issue with RC0

we will run into wierd issue, if we try to use ComboBox in DataGrid (Silverlight RC0). you can find more details in this forum post

I think this will be addressed before Silverlight 2.0 is released. Here is a temporary workaround

I  got all the code from the forum post, ( so I am not including the code)

Here is a workaround

Create a class, similar to this and set IsDropDownProperty to true in the loaded event

 public class MyComboBox : ComboBox
        public MyComboBox()
            DefaultStyleKey = typeof(ComboBox);
            this.Loaded += new RoutedEventHandler(MyComboBox_Loaded);   
      void MyComboBox_Loaded(object sender, RoutedEventArgs e)
            IsDropDownOpen = true;
After declaring the Namespace

 use the combobox like this

<data:DataGridTemplateColumn Header=”City”>
      <TextBlock Text=”{Binding City}” />
      <src:MyComboBox SelectedItem=”{Binding City, Mode=TwoWay}”
            ItemsSource=”{Binding CityList, Source={StaticResource cityProvider}}”



3 thoughts on “ComboBox in DataGrid Issue with RC0

  1. You have done a greate job. But one thing you forgot to add DisplayMemberPath property , so the code will be :

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s