AvaloniaCommunity / Material.Avalonia

Material design in AvaloniaUI
MIT License
792 stars 70 forks source link

Display Validation Errors on TextBox missing #402

Closed SKProCH closed 3 hours ago

SKProCH commented 4 hours ago

Discussed in https://github.com/AvaloniaCommunity/Material.Avalonia/discussions/401

Originally posted by **djhohnstein** September 20, 2024 Hey everyone, new to Avalonia. Had a question about displaying validation errors and the MVVM toolkit. I have the following ViewModel: ```c# public class CustomViewModel : ViewModelBase { [ObservableProperty] [NotifyDataErrorInfo] [CustomValidation(typeof(SharedDefinitions), nameof(SharedDefinitions.ValidateTextAlphaNumeric))] [Required] private string _name; ... } ``` Let's say I have the corresponding UserControl with the following defined: ```xml ``` Upon the rendering of my view and entering of data into the `TextBox` element, I see that the outline of this box properly changes to red when a validation error occurs from the `ValidateTextAlphaNumeric` function (which returns a `ValidationResult` object), but the error message of that `ValidationResult` is **not** rendered on the corresponding TextBox hint. Is it possible to show the validation errors for that field on the text box?
SKProCH commented 3 hours ago

Should be published soon as v3.7.4.