# Empty Cells in Combobox column

**PROBLEM**

When you use the [GridViewComboBoxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/columntypes/column-types-combobox-column) you might encounter empty cells in that column:

![Telerik WPF DataGrid troubleshoot blank cells](https://www.telerik.com/products/wpf/documentation/assets/5c7ef6d8c126c4f46ff5cabd0bfe6b35/gridview_troubleshoot_blank_cells.png)

**CAUSE**

First, you need to check:

* The Output for Binding exceptions.
* If the types are of the same type.
* If the **DisplayMemberPath** property is set correctly.

If you do not encounter any of the above-mentioned problems, then you probably use ElementName binding for that column, e.g.

**Example 1: Binding with ElementName**

```XAML
<telerik:GridViewComboBoxColumn Header="Category"
DataMemberBinding="{Binding CategoryID}"
ItemsSource="{Binding Path=DataContext.Categories, ElementName=RootElement}"
DisplayMemberPath="CategoryName"
SelectedValueMemberPath="CategoryID" />
```

This will not work, as the DataContext of the cell would not be the ViewModel, but the business object related to the row instead. We do not recommend such approach.

**SOLUTION**

There are two ways of solving the issue :

## Setting the ItemsSource of GridViewComboBoxColumn

* Expose the ViewModel as a static resource on the page so that it can be easily accessible by the binding:

**Example 2: Exposing the ViewModel as a Static Resource**

```XAML
<UserControl.Resources>
    <local:MyViewModel x:Key="MyViewModel" />
</UserControl.Resources>
```

* Set the ItemsSource of the ComboBox column:

**Example 3: Setting the ItemsSource of GridViewComboBox declaratively**

```XAML
<telerik:GridViewComboBoxColumn Header="Category"
DataMemberBinding="{Binding CategoryID}"
ItemsSource="{Binding Path=Categories, Source={StaticResource MyViewModel}}"
DisplayMemberPath="CategoryName"
SelectedValueMemberPath="CategoryID" />
```

**Example 4: Setting the ItemsSource of GridViewComboBoxColumn programmatically**

```C#
private void gridView_DataLoaded(object sender, EventArgs e)
{
    (this.radGridView.Columns["Category"] as GridViewComboBoxColumn).ItemsSource = GetCategories();
}
```

```VB.NET
Private Sub gridView_DataLoaded(ByVal sender As Object, ByVal e As EventArgs)
    TryCast(Me.radGridView.Columns("Category"), GridViewComboBoxColumn).ItemsSource = GetCategories()
End Sub
```

## Setting the IsLightWeightModeEnabled property

As of **R2 2016** GridViewComboBoxColumn exposes the IsLightWeightModeEnabled. When set to True, a completely new lookup logic is used, which improves the performance of the column and could be a solution for a scenario when having empty cells in it. More information can be found in the [ComboBoxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/columntypes/column-types-combobox-column) topic.

## See Also

* [Binding GridViewComboBoxColumn by using the EnumDataSource utility](https://www.telerik.com/products/wpf/documentation/common-information/consuming-data/enumdatasource)
* [Handle SelectionChanged for ComboBoxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/how-to/selectionchanged-comboboxcolumn)
* [Filter items in ComboboxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/how-to/filter-the-items-in-comboboxcolumn)
* [Number of clicks in the ComboBoxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/how-to/combobox-column-clicks)
* [ComboBoxColumn](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/columntypes/column-types-combobox-column)
