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

PreserveFocus() in GridViewDataControl.OnItemsChanged

2 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 27 Jun 2012, 07:08 AM
Hi, support team,

We've upgraded to 2012.2.0607.40 recently and I found one chagne in the RadGridView that impacts user experience.
Basically we have input boxes (hosted inside the grid) to allow user to enter something to filter the grid. The problem is every time user entered something in the text box, GridViewDataControl.OnItemsChanged will be executed, and the grid found that it has the focus (because we host the text box in the grid) so it call a PreserveFocus internally to set the focus to itself and actually steal the focus from the text box inside the grid.

Right now my work around is to override the OnItemsChanged to set the focus back but it's still having problem sometimes.
     protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
     {
      var inputElement = Keyboard.FocusedElement;
      base.OnItemsChanged(e);
      if (inputElement is TextBox)
      {
        Dispatcher.BeginInvoke(() => Keyboard.Focus(inputElement), DispatcherPriority.Input);
      }
    }

Can you look into fix the problem?

Thanks
Jason

2 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 29 Jun 2012, 10:52 AM
Can some one have a look at this problem?

Thanks
Jason
0
Jason
Top achievements
Rank 1
answered on 10 Jul 2012, 03:45 AM
Can some one have a look at this problem?
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Share this question
or