Hi Chuck, When you drag-drop the header cell, all elements in it are removed from the visual tree ( i.e. its unloaded event is raised). Thus, the behaviour is reproduced even though the default value for the elements is the same value as the grid's TabIndex. You can easily test this by reordering the columns without drag - changing columns display indexes runtime. Your code should work if you are using a Dispatcher with Background priority. This is because of the time when ColumnReordered event and the actual Drop operation is executed. I have attached a test project which demonstrates the approach. I hope this helps.
The default value for these editors is the same value as the grid's TabIndex, so they are all the same at load. Changing the value at any point (before, after or during reorder) does not appear to have any effect on the tab order. Changing values in the FieldFilterEditorCreated event is a no go as the editors are added in declaration order and when a custom editor is added this event does not appear to fire. I did attempt to change the TabIndex in the grids ColumnReordered event with a simple loop as a test. Attempted with the display index, the grid's tab index as a starting value and just an increment starting at 1. The controls appear to accept and store the new TabIndex values, but these changes have no effect on the actual tab order. foreach (GridViewHeaderCell headerCell in ((RadGridView)sender).ChildrenOfType<Telerik.Windows.Controls.GridView.GridViewHeaderCell>().OrderBy(xt => xt.Column.DisplayIndex)) { headerCell.TabIndex = headerCell.Column.DisplayIndex; foreach (FieldFilterControl filteringControl in headerCell.ChildrenOfType<FieldFilterControl>()) { filteringControl.TabIndex = headerCell.Column.DisplayIndex; } }
As it turns out this issue is related to the way how the elements are added in the logical tree of the application. Generally, WPF sets the tab order to match the logical tree. So, the controls placed in the FilterRow of the column have some predefined tab order (TabIndex) which remains the same after reordering of the columns runtime. The solution for this issue is to change the TabIndex of the needed control (the one placed in the FilterRow) once the Column is reordered. However, there is no generic way for setting the TabIndex, since it is very specific for each WPF application, i.e. a developer needs to decide what values are needed for the TabIndex per application. A suitable event for achieving this is GridView's FieldFilterEditorCreated.