DoubleEditBox in DataGrid does not select text on focus (and other issues)

Editors for WPF Forum

Posted 11 years ago by Max Palmer
Version: 13.1.0581
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

I am using a DoubleEditBox in a data grid cell (via a CellEditTemplate) and have an issue where I would like to tab between cells in the grid and then type to enter a new value. This works fine for most of the editor types, i.e. textbox, etc, but does not work when the cell editor is a DoubleEditBox. I would expect that the editor should select the text on receipt of the focus and then the text is replaced when you type, but this does not happen (no text is selected, nothing is highlighted and you have to click on the text with the mouse before you can enter a value which is very frustrating).

I note that the DoubleEditBox uses a MaskedTextBox internally and that this has an IsAutoSelectAllEnabled property, but this value is readonly, is set to false and not exposed at the level of the DoubleEditBox. Is this related to the issue I am seeing and what determines how this property is set?

Finally, I also have a problem where I can only edit the text in the cell by clicking on the area of the editor that contains visible text. If I click in the empty space to the right, it doesn't go into edit mode. Why is this and what can I do about it?

Thanks,

Max

Comments (4)

Posted 11 years ago by Max Palmer
Avatar

I've made some progress on the edit box, when the cell gets the focus it looks for the masked text box and selects all text. This is non ideal, but works for the moment. The only issue is that if you click on the text with the mouse it selects it rather than placing the caret at the correct location.

I have another issue in that pressing tab in the DoubleEditBox moves the focus outside of the grid. All the other cells tab to the next cell. The DataGridCells themselves have sensible tab indexes set, but looking in snoop, the doubleEditBox has some crazy number set as a tab index. Can this be cleared somehow?

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Max,

I'm assuming you are using the WPF DataGrid. If so, the issues you describe above is one reason we provide the Editors.Interop.DataGrid assembly. The DataGrid can be touchy when dealing with focus and tab order. Specifically, our DataGridDoubleColumn (which uses DoubleEditBox as it's editor) will focus and forward mouse clicks from the DataGrid directly to the DoubleEditBox. Is there a reason you don't/can't use the DataGridDoubleColumn?

We don't ever set the TabIndex property on our controls, so I'm not sure where that is coming from.


Actipro Software Support

Posted 11 years ago by Max Palmer
Avatar

The grid is not the WPF datagrid but the Telerik data grid, so I guess we can't use the DataGridDoubleColumn. Is there any more info on how this class handle focus and tab order behaviour?

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Max,

Our entire Editors.Interop.DataGrid assembly is open source and available on CodePlex at http://actipro.codeplex.com

The Primitives\DataGridPartEditBoxColumnBase.cs class handles preparing the DoubleEditBox for editing, including passing focus. This is specfic to the WPF DataGrid though, so I'm not sure how that fits in Telerik's DataGrid. Also, like I said before we don't change any relating to tab order, that is probably something specific to the WPF DataGrid (or Telerik's in your case).


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.