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

How to set focus on a ComboBox cell and open the combo box.

1 Answer 172 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 25 Oct 2010, 08:39 PM
Hi..
I have a button that adds a new row to the grid. I need to set focus to the new row and open the first cell - which is combo box and set focus.
I have tried the following but it does not work.. any ideas?  thanks

 

this.gridPO_det.ScrollIntoViewAsync(new_det

 

, (f) =>

{

 

GridViewRow row = f as GridViewRow;

 

 

if (row != null)

 

{

 

GridViewCell cell = row.Cells[0] as GridViewCell;

 

cell.BeginEdit();

Dispatcher.BeginInvoke(

new Action(() =>

 

{

((

RadComboBox)cell.GetEditingElement()).IsDropDownOpen = true;

 

}));

}

});

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Oct 2010, 09:10 AM
Hello Jon,

You may create a separate style for the editor element in the GridViewComboBoxColumn. For example:

Window.Resources>
    <Style x:Key="ComboBoxEditor" TargetType="telerik:RadComboBox">
        <Setter Property="IsDropDownOpen" Value="True" />
    </Style>
</Window.Resources>

<telerik:GridViewComboBoxColumn Header="Nationality" 
EditorStyle="{StaticResource ComboBoxEditor}"                                             DataMemberBinding="{Binding CountryID, Mode=TwoWay}"                                                DisplayMemberPath="Name"                                                                                                                    SelectedValueMemberPath="ID"                                               
SortMemberPath="Name">
 

Sincerely yours,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jon
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or