# Other .NET Programming > Windows Presentation Foundation (WPF) & XAML forum >  How to display multiple column ComboBox in DataGrid?

## maxcom.programmer

Hi,

I have requirement where I have to display a multi-columns ComoboBox in DataGrid. I am using Telerik WPF RadGridView and RadComboBox.

I decided to modified RadComboBox ControlTemplate to include RadGridView and partially I able to achieve the requirement but still facing below mentioned issues. The reason behind placing RadGridView insde ComboBox is to display column title and to allow sort.

1. The ComboBox not closing when I select an item from ComboBox.

2. The selected value should be displayed in Grid column and it should be the assign to SelectedValue property of ComboBox.

I have tried setting IsDropDownOpen property to false on SelectedItem property of ComboBox but it also not working.

Please help to resolve this issue. PFA image to understand requirement.

----------


## maxcom.programmer

Hello,

I am able to achieve the requirement. However it still needs some improvement.

I have modified RadComboBox ControlTemplate and replace ScrollViewer and ItemsPresenter with 

below RadGridView. It's working fine however I want following improvement

1. In-case there are multiple ComboBoxes I have to create ControlTemplate for each since 

each ComboBox may have different ItemsSource, No. of columns, DisplayMembers and 

SelectedValues.

2. When first time ComboBox display it don't have value selected eventhough it is there in 

ItemsSource of GridView. Once I select an item from Combo next time onward it displays the 

value.

<telerik:RadGridView x:Name="RadGridView99"
    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
    ItemsSource="{TemplateBinding ItemsSource}"
    AutoGenerateColumns="False"
    IsReadOnly="True"
    SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, 

Path=SelectedItem}"
    ShowGroupPanel="False"
    CanUserFreezeColumns="False"
    RowIndicatorVisibility="Collapsed"
    IsFilteringAllowed="False"
    SelectionMode="Single"
    telerik:StyleManager.Theme="Office_Blue"
    Width="Auto"
    Height="Auto">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="Code"
            DataMemberBinding="{Binding CurrencyISOCode}" />
        <telerik:GridViewDataColumn Header="Name"
            DataMemberBinding="{Binding CurrencyName}" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Any help will be highly appreciated.

Thanks

----------


## maxcom.programmer

Also I have bind IsOpen property of Popups inside RadComboBox ControlTemplate to IsDropDownOpen property of RadComboBox which has been set to false on SelectedItem change. And that's it when I click any item in ComboBox it will close the popup.

----------

