I have user control where I have defined a default inputbinding to allow user to submit form on Ctrl-Enter
<UserControl.InputBindings>
<KeyBinding Key="Enter" Modifiers="Control" Command="{StaticResource SubmitCommand}" />
</UserControl.InputBindings>
I have XamNumericEditor on the control, when the user is focused on that control the inputbinding fails to execute but on any other control (TextBox etc) it works as expected and the command is executed. Anything I can do so the keyboard binding is propagated to the usercontrol.
<igWPF:XamNumericEditor x:Name="_Qty"
Value="{Binding Quantity, ValidatesOnDataErrors=True}"
SpinIncrement="{Binding QuantityIncrement}"
VerticalAlignment="Center"
ToolTip="{x:Static Member=ovf:Descriptions.ORDER_QUANTITY}"
ValueType="System:Int32"
Mask="nnn,nnn,nnn"
PromptChar=""
Format="N0"
SelectAllBehavior="SelectAllCharacters"
SpinButtonDisplayMode="Always"
EditModeStarted="EditModeStarted">
<igWPF:XamNumericEditor.ValueConstraint>
<igWPF:ValueConstraint MinInclusive="0"
MaxInclusive="999999999"
ValidateAsType="Integer32"/>
</igWPF:XamNumericEditor.ValueConstraint>
</igWPF:XamNumericEditor>
Hello acraft,
I have been looking into your issue and have managed to replicate this into an isolated project. It appears that this happens because enter is being used for managing the editor modes. I am currently looking for ways to overcome this. I will keep you updated.
Thanks yes appears to be do with editmode, I tried to set IsAlwaysInEditMode=true which solved the behavior for ctrl-enter, but means that the select all on focus behavior has changed (SelectAllBehavior="SelectAllCharacters"). We want it so whenever the user tabs/mouses into the control it by default selects all and when isAlwaysInEditMode is true then the secondtime you enter the control not all the characters are selected.
thanks
yes thanks works as expected
I am just checking if you got this worked out, or you still require any assistance, or clarification on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.
Hi acraft,
I have been looking into this for you and usually by default the SelectAllBehvior does not turn on the functionality, it merely suggests what the SelectAll method should. I assume you have called the method in the EditModeStarted event, which will now fire only once. This being said I can suggest you handle the XamNUmericEditors’ GotFocus and GotKeyboardFocus events like so:
private void xamNumericEditor2_GotFocus_1(object sender, RoutedEventArgs e) { Dispatcher.BeginInvoke(new Action(() => { (sender as XamNumericEditor).SelectAll(); }), System.Windows.Threading.DispatcherPriority.Background, null); } private void xamNumericEditor2_GotKeyboardFocus_1(object sender, KeyboardFocusChangedEventArgs e) { (sender as XamNumericEditor).SelectAll(); }
Please let me know, if you require any further assistance on the matter.