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
110
Xamdatagrid dynamic field validation
posted

Hello,

I don't find how to set the validation on dynamic fields.

My project is based on the sample because I need dynamic fields.

https://ko.infragistics.com/community/blogs/b/blagunas/posts/xamdatagrid-dynamically-create-and-data-bind-columns-with-an-editor-of-your-choice

My dynamic fields, which are the equivalent of the Period class in this example project, implements INotifypropertyChanged.

In my project, the setter of a dynamic field throw an exception if the value is incorrecte.

such as :

public int MyProperty{
  set{
          if(value<0) 
               throw new ArgumentException("No negative value)
          _property=value;
          RaisePropertyChanged(nameof(MyProperty));
         }
 get{
  return  _property;
  }
 }

I have define in the fieldlayoutSettings of my xamdatagrid:

SupportDataErrorInfo = "RecordsAndCells" and DataErrorDisplayMode="ErrorIconAndHighlight" but nothing appears.

My viewModel doesn't implement any ErrorInfo interface (IDataErroInfo,...).

In debug mode, the exception is thrown but it is never "caught"!! So the field seems Ok whereas the value is incorrect, forbidden,....

I don't understand why nothing is displayed because I followed this example which seems really simple

https://www.infragistics.co.kr/help/wpf/xamgrid-validating-data

Did I miss something?

Thank you.