This is a migrated thread and some comments may be shown as answers.

Problem with RadGridView navigation and automatic validation

1 Answer 11 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 02 May 2017, 10:00 PM

I have a RadGridView with ItemsSource bound to a collection of business objects.  The grid has a GridViewDataColumn bound to a property with a TwoWay binding.  The property has a validation attribute.

When the user is editing the cell, and presses <Enter>, the validation attribute's IsValid() method is invoked, and if validation succeeds, the griid navigates to the same column in the next row.  But if validation fails, the failure is visualized and the navigation does not occur.  In fact, any attempt to navigate away from the cell by any means causes validation, and if the validation fails, the navigation does not occur.  This is all good, and exactly as it should be.  Anything less would be wrong -- what's the point of validation if it doesn't force the user to enter valid data?

But here's my problem.  I also want the down and up arrows to navigate up and down while editing.  Seems as if it should be straight forward -- just preview KeyDown, handle up and down keys and execute the grid's MoveUp and MoveDown commands, right?  Wrong.  When the grid's MoveUp or MoveDown command is executed, the validation attribute's IsValid() method is still invoked, but a failed validation does not prevent the navigation.

This seems like such a routine requirement that I feel like I must be missing something.  The reason for the existence of the MoveUp, MoveDown, etc., commands seems to be the recognition that navigation controls might need to be more robust that the default behaviors.  But those command circumventing validation appears to make them useless.  Surely I'm just missing something.

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 May 2017, 02:12 PM
Hello Patrick,

We have replied you in the support thread you opened regarding this topic. In order to keep the communication consistent and avoid double posting, I would kindly ask you to continue any further discussion regarding this inquiry in the support thread.

Thank you in advance for understanding.

Have a great weekend!

Best Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or