CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2013
    Posts
    4

    How to display multiple column ComboBox in DataGrid?

    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.
    Name:  MulticolumnCombo1.png
Views: 5076
Size:  62.4 KB

  2. #2
    Join Date
    May 2013
    Posts
    4

    Re: How to display multiple column ComboBox in DataGrid?

    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

  3. #3
    Join Date
    May 2013
    Posts
    4

    Re: How to display multiple column ComboBox in DataGrid?

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured