This is a migrated thread and some comments may be shown as answers.

RadGridView inside RadComboBox

4 Answers 211 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 28 May 2013, 01:19 PM
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.


4 Answers, 1 is accepted

Sort by
0
Max
Top achievements
Rank 1
answered on 29 May 2013, 07:19 AM
Any comment/suggestions Telerik team?
0
Max
Top achievements
Rank 1
answered on 31 May 2013, 08:13 AM
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
0
Siddle
Top achievements
Rank 1
answered on 29 Dec 2016, 10:39 AM
Hello, How to know that RadGridView is loaded or user is ready to use combo box? When we trying to select item the  its not opening immdiatly, we want to show a message if RadGridView  is not loaded but how?
0
Ivan Ivanov
Telerik team
answered on 29 Dec 2016, 03:41 PM
Hello,

Can you please shed some more light on your scenario? Is RadGridView hosted in the ComboBox's drop down? As for tracking when a control gets loaded, you can subscribe to the FrameworkElement.Loaded event.

Regards,
Ivan Ivanov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ComboBox
Asked by
Max
Top achievements
Rank 1
Answers by
Max
Top achievements
Rank 1
Siddle
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or