SearchPanel Focus

2 posts, 0 answers
  1. Kieron
    Kieron avatar
    8 posts
    Member since:
    Jan 2016

    Posted 27 Jul 2016 Link to this post


    I've enabled the search panel of a grid, the grid is the only control on a form and I want the initial focus to be in the textbox of the search panel when the user opens the form, how do I go about achieving this?



  2. Dilyan Traykov
    Dilyan Traykov avatar
    615 posts

    Posted 27 Jul 2016 Link to this post

    Hello Kieron,

    The desired behavior can be achieved by handling RadGridView's Loaded event and setting the focus to the TextBox element of the GridViewSearchPanel, like so:

    public MainWindow()
        this.clubsGrid.Loaded += ClubsGrid_Loaded;
    private void ClubsGrid_Loaded(object sender, RoutedEventArgs e)
        var searchPanel = (sender as RadGridView).ChildrenOfType<GridViewSearchPanel>().FirstOrDefault();
        var textBox = searchPanel.ChildrenOfType<TextBox>().FirstOrDefault();

    Please let me know if such an approach would work for you.

    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top