RadGridView inside RadComboBox

3 posts, 0 answers
  1. Max
    Max avatar
    27 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    Hi,

    I have requirement to display multiple columns under ComboBox with title and it should be also allow to sort RadGridView items. To achieve these requirement I decide to place a RadGridView inside RadComboBox.

    I have almost achieved these requirement however there is only one issue. When I click on an item of RadGridView the RadComboBox is not closing down which is RadComboBox default behavior.

    I tried to set IsDropDownOpen property of RadComboBox when user selects an item but it still not working.

    To modify ControlTemplate of RadComboBox I referred to following blog.
    http://www.nullskull.com/a/1359/wpf-datagrid-as-combobox-dropdown.aspx

    In my case I have place RadGridView inside NonEditableTemplate. I don't know it's correct or not but yes it is working except the aforementioned issue. PFA image which displays the result so far I able to achieve.

    Please help to resolve this issue.


  2. Max
    Max avatar
    27 posts
    Member since:
    May 2013

    Posted 29 May 2013 Link to this post

    Any comment/suggestions Telerik team?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Max
    Max avatar
    27 posts
    Member since:
    May 2013

    Posted 31 May 2013 Link to this post

    Hello,

    I am able to achieve the requirement. However it still needs some improvement. 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.

    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
Back to Top