Declined
Last Updated: 10 Feb 2020 09:28 by ADMIN
Martin Ivanov
Created on: 18 Dec 2019 15:38
Category: GridView
Type: Bug Report
1
GridView: Search box in the GridViewSearchPanel is not included in the tab order

The search box TextBox element used with the search-as-you-type feature is not focused when you press the Tab key. This happens because the search box is excluded from the tab order (IsTabStop=False).

Use the ChildrenOfType extension method to get the TextBox element and set its IsTabStop to True.

private void gridView_Loaded(object sender, RoutedEventArgs e)
{
	var searchBox = this.gridView.ChildrenOfType<TextBox>().FirstOrDefault(x => x.Name == "PART_SearchAsYouTypeTextBox");
	searchBox.IsTabStop = true;
}

1 comment
ADMIN
Vicky
Posted on: 10 Feb 2020 09:28

Hi,

This behavior is expected due to the default design of the RadGridView control. It implements a custom tab navigation logic, which implies that the IsTabStop property of the GridViewSearchPanel defaults to false. The search box TextBox element has a TemplateBinding to its parent GridViewSearchPanel and therefore it also has IsTabStop="false", coming from the default implementation of the search panel. This implementation included setting the IsTabStop property to false in code-behind. Now, the setter for the IsTabStop property is in the default Style of the GridViewSearchPanel, which enables overriding the property through a custom Style.

To include the search box in the tab order, you can either use the ChildrenOfType extension method to get the TextBox element and set its IsTabStop property to true (like in the provided code snippet), or define a Style like the following:

<Style TargetType="telerik:GridViewSearchPanel">
    <!-- Add BasedOn="{StaticResource GridViewSearchPanelStyle}" if you use the NoXaml version of the binaries. -->
    <Setter Property="IsTabStop" Value="True"/>
    <Setter Property="Focusable" Value="False"/> <!-- Needed to avoid the default dashed FocusVisual border of the panel. -->
</Style>

Note that you might also need to implement a custom logic (e.g. creating a custom keyboard command provider) to change the default tab order of the GridView - it is designed to focus its cells first.

Regards,
Vicky
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.