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

Combobox arrow not showing a in a combobox cell

1 Answer 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Erez
Top achievements
Rank 1
Erez asked on 06 Aug 2009, 12:21 PM

Hello,

I know how to create a combobox column and fill it with value, however

each combobox cell in the column does not show the drop down arrow, unless

the user clicks on the cell.

I tries using a combobox template on the column and visually it works, however when I do so

the combobox's possible values are not displayed in its drop down.

Hope you can assist.

Erez

 

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 07 Aug 2009, 10:11 AM
Hello Erez,

Each cell has two modes -- normal and edit. While in normal mode you do not see the editor (combo in this case). Only when the cell enters edit mode (the user clicks on it) the editor is loaded and could be seen. That is why you do not see the combo arrow -- in fact when the cell is in normal mode you are actually seeing a TextBlock and not a combo.

If you would like to see a combo all the time you should define a cell template for the column. I have prepared a small sample project that does this. The basic idea is that there will be a pair of combos -- one is the editor coming automatically from the GridViewComboBoxColumn and the other one is the one I have defined inside the CellTemplate. I have made the second one green just for distinction. The good news is that you can edit data from both combos. To be able to enter into edit mode though you will have to press F2 since we have redefined the cell template and the double click will no longer work. When using the "green" combo you will be actually editing data without entering into edit mode :)

                <telerik:GridViewComboBoxColumn  
                    Header="Type" 
                    DataMemberBinding="{Binding PersonTypeID, Mode=TwoWay}" 
                    ItemsSource="{StaticResource comboItemsSource}" 
                    DisplayMemberPath="Name" 
                    SelectedValueMemberPath="ID"
                    <telerik:GridViewComboBoxColumn.CellTemplate> 
                        <DataTemplate> 
                            <StackPanel> 
                                <telerik:RadComboBox  
                                    Name="displayCombo" 
                                    Foreground="Green" 
                                    ItemsSource="{StaticResource comboItemsSource}" 
                                    DisplayMemberPath="Name" 
                                    SelectedValuePath="ID" 
                                    SelectedValue="{Binding PersonTypeID}"
                                </telerik:RadComboBox> 
                            </StackPanel> 
                        </DataTemplate>     
                    </telerik:GridViewComboBoxColumn.CellTemplate> 
                </telerik:GridViewComboBoxColumn> 
 

Please, examine the attached project and let me know if you have any other questions.

Regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Erez
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or