Tabbing through header controls in templates in RadGridView

2 posts, 0 answers
  1. Derek
    Derek avatar
    1 posts
    Member since:
    Jun 2012

    Posted 08 Jan 2014 Link to this post

    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!

  2. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 14 Jan 2014 Link to this post

    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 >>
  3. DevCraft banner
Back to Top