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

Tabbing through header controls in templates in RadGridView

1 Answer 4 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 09 Jan 2014, 12:58 AM
Hi and thank you for looking at my issue!

I am trying to tab through the header cells in a radgridview and trying to skip focus on the cells themselves and go straight to the control.  I have read some threads that suggest using a custom CellTemplate but I also have the complexity of a stackpanel and textblocks in addition to a radcombobox (see below):

<telerik:GridViewBoundColumnBase UniqueName="PriceColumn" >
   <telerik:GridViewBoundColumnBase.Header>
      <StackPanel>
         <TextBlock Text="PRICE" />
         <telerik:RadComboBox ItemsSource="{Binding Path=DataSource.PriceList, Source={StaticResource ViewModel}}" 
    SelectedValue="{Binding Path=DataSource.InstructPriceForAll, Source={StaticResource ViewModel}, Mode=TwoWay}" 
            IsEnabled="{Binding Path=DataSource.IsPriceForAllEnabled, Source={StaticResource ViewModel}}"
            DisplayMemberPath="Text" SelectedValuePath="Value" Width="15" />
      </StackPanel>
   </telerik:GridViewBoundColumnBase.Header>
   <telerik:GridViewBoundColumnBase.CellTemplate>...</telerik:GridViewBoundColumnBase.CellTemplate>
</telerik:GridViewBoundColumnBase>

So my question is, how do i tab straight to the Radcombobox instead of the cell itself?

Thank you for your time!

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 14 Jan 2014, 08:46 AM
Hello Derek,

In order to directly pass the focus to the control, you will have to implement an additional logic. You can subscribe to GridView's CurrentCellChanged event  and execute a code similar to the one below:
private void clubsGrid_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)
        {
            if (e.OldCell != null && e.OldCell.Column.UniqueName=="Name")
            {     
                (e.OldCell.Column.Header as StackPanel).ChildrenOfType<RadComboBox>().FirstOrDefault().Focus();               
            }
        }

I hope this helps.


Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or