-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property HasErrors of ObservableValidator is auto-generated in controls with auto-generation #881
Comments
It's not clear at all why this is a bug, and the issue only describes some WPF-specific behavior. You'd need to include more details on what exact change you'd expect on |
Hi @Sergio0694 , please let me give more details about the context. ObservableValidator is a class that can be used to add validation to objects and these objects can be bound to ui-controls. These controls many time auto-generate the ui based on the information in the class itself, for instance, WPF DataGrid take all the properties of the class and creates the columns out of this. This works fine in most scenarios, but in other cases it is necessary to tweak this mechanism so the classes are bound to control seamlessly without having to write complex customizations. For this purpose exists the System.ComponentModel.DataAnnotations attributes. https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.displayattribute?view=net-8.0 In this particular case, it is the HasErrors property that should be decorated with DisplayAttribute, so when it is bound to a control this property doesn't generate ui
It worth noting this is not only in WPF, but any ui framework of control using System.ComponentModel.DataAnnotations, and it's probably not a bug but a feature enhancement. |
@Sergio0694 I just created a PR with the fix/feature enhancement. I appreciate if you can take a look. Thanks |
Thanks @Sergio0694! |
Describe the bug
When binding an object inheriting ObservableValidator class to a control that has auto-generation a field is created for that property.
For instance when binding to WPF DataGrid the following column appears
Regression
No response
Steps to reproduce
Expected behavior
No column should be generated for the property HasErrors
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: