Current filter:
                                You should refresh the page.
                                  • Hi!

                                    I've got a quick question.. Let's say user types incorrect value into TextEdit control (e,g, "Abc" in numeric field) and then attempts to leave the editor. In this case DX grid will keep the focus in editor and display error icon. There is no way to leave the editor except pressing "esc" - in this case DX will reset the editor to its initial value. I'd like to have this behaviour for any attempt to leave the control - e.g. when user press "enter" or clicks somewhere - editor should reset value to its initial value without prompting user about validation error and forbidding leaving editor. Is that achievable? I was playing with different combinations of InvalidValueBehaviour and ValidateOnEnterKeyPressed properties, but got no luck yet..

                                    Thank you!

                                1 Solution

                                Creation Date Importance Sort by

                                Our editors doesn't allow automatically resetting invalid values to the previously entered valid value. As you need to immediately reset invalid values to valid values when your users commit them, you can get rid of the validation approach and implement your checking logic in the EditValueChanging event handler. This event is raised before an editor's EditValue is changed and allow canceling this change. For example, you can use this event in the following manner:

                                <dxe:TextEdit x:Name="textEdit1" EditValueChanging="textEdit1_EditValueChanging" ValidateOnTextInput="False" />
                                private void textEdit1_EditValueChanging(object sender, DevExpress.Xpf.Editors.EditValueChangingEventArgs e) { e.IsCancel = e.NewValue is string && e.NewValue.ToString() == "test"; e.Handled = true; }

                                See the attached screencast demonstrating this approach in action. What do you think about it?


                                • Customer61333 10.22.2019

                                  This works fine, thank you!

                                • Kirill (DevExpress Support) 10.23.2019

                                  You are welcome!