Hello,
I am using the XamNumericEditor and wonder if there is a better solution how to select whole content of the control. What I have seen so far is related to code behind and SelectAll().
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/86785/select-all-text-when-editing-the-value
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/87417/how-change-xamcurrencyeditor-s-default-cursor-position-to-instead-of-cents-when-gotfocus
The idea to create the same codeline over and over again does not look interessting to me.
Is there a property like SelectAllOnFocus that does the trick?
Thanks
Niko
Hello Nikolaus,
The requested feature is not currently supported out of the box. However, I can suggest implementing a style with event setter so you can use it just as you would with a property:
<Style TargetType="{x:Type igEditors:XamNumericEditor}" x:Key="styleName"> <EventSetter Event="GotFocus" Handler="HandleFocusEditorEvent"/> </Style>
And in code behind:
private void HandleFocusEditorEvent(object sender, RoutedEventArgs e) { ((XamNumericEditor)sender).SelectAll(); }
Should you have any further questions, please let me know.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
Hello Tihomir,
thanks - this does the trick for me.
Hello Niko,
I am glad that you have found my suggestion helpful.
Thank you for using Infragistics components.
follow up question: There is a setting for AlwaysInEditMode for the of XamNumericEditor (and the similar group of controls like XamDataTimeEditor). If this is set to True, focus setting does work on tabs but not on mouse click. If I set it to False then it works in both ways, but I need then 2 tabs to leave the control.
Do you have advice on that as well?
Apologies for the delay.
Regarding AlwaysInEditMode, this option is available for all editors, and it just keeps the editor in edit mode at all times, even when loosing focus. If the control is embed in another control, the value of this property is ignored and always set to false.
I've tried to reproduce the tab navigation, but the editor is leaving focus with a single tab click, and mouse clicks focus on it, so I will probably need a sample to test this.
Should you wish me to take a further look at it, I will ask you to submit a new thread as this is another question, and I will assist you there. The goal of this is so our community members can benefit from the information of these posts, by utilizing the search engine.