Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
XamDatagrid BindingValidator check whether the grid is valid or not
posted

In my xaml, i use a lot of binding validationRules

<Binding RelativeSource="{RelativeSource TemplatedParent}"
 Path="Content">
 <Binding.ValidationRules>
 <validations:ValidateNotNullOrWhiteSpace
 ValidatesOnTargetUpdated="True" />
 </Binding.ValidationRules>
</Binding>

Now I have a button that launch some calculation and I have a function that show a messagebox if there is validation error in the form.

To check if the form isValid, I use the native BindingValidator and IsValid.


private IBindingValidator _bindingValidator = new BindingValidator();
...
_bindingValidator.IsValid(this)

My problem is that the validation rule of the grid are not working with this and the IsValid function return true.

Is there any way to know if the whole grid is valid with XamDataGrid

Thank you,

Charles

Parents
  • 29610
    Offline posted

    Hello Charles,

    My team and I have been reviewing this forum thread, and I have a couple of questions for you in this case. Would it be possible for you to please provide some information regarding the following?

    1. Is the Binding that you have provided at the top of this thread currently used in your XamDataGrid?
    2. If so, where do you have this binding placed?

    With the above questions, I cannot say for absolute certain if those Binding.ValidationRules will work in the XamDataGrid – and I highly doubt they will work if placed directly on the grid itself. You would likely need to do this on a cell.

    With the above said, I feel you might be better suited to potentially using the IDataErrorInfo interface, as the XamDataGrid supports this out-of-the-box, and this may help you to find out if the grid is valid. You can read further about the support of the IDataErrorInfo interface for the XamDataGrid here: https://www.infragistics.com/help/wpf/xamdatapresenter-validating-data.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children