I use the UltraControlContainerEditor to allow the of a specialised text box when editing a particular column in a UltraGrid. The specialised text box is inherited from UltraTextEditor.
When the user enters any cell I want the text to be highlighted. To achieve this I have always used:
private void grid_AfterEnterEditMode(object sender, System.EventArgs e){ Infragistics.Win.EmbeddableEditorBase editor = this.gridQty.ActiveCell.EditorResolved;
if (editor.SupportsSelectableText) { editor.SelectionStart = 0; editor.SelectionLength = editor.TextLength; }}
The issue I face is that SupportsSelectableText is always false for my custom control. I have tried adding a SupportsSelectableText property to the control but this doesn't help.
Is there a way to make my custom control work with the AfterEnterEditMode code above?
Many ThanksPaul
Hi Paul,
The UltraControlContainerEditor cannot support selectable text because it has no way of knowing whether the EditingControl you are using supports selection or how to select text within it.
If you really want to work at it, you could probably make this work by deriving your own editor from the ControlContainerEditor class. That's the actual editor class, not the component like UltraControlContainerEditor. You could override SupportsSelectableText and then handle the SelectionStart and SelectionLength properties yourself by delegating them off to the UltraTextEditor.
But I think this is probably more trouble that it's worth. It depends what you are trying to do, but Boris's solution might be easier.