From fc5501d754afb44ed378e61b541e7b92d85ad19d Mon Sep 17 00:00:00 2001 From: kulikov-dev <40471760+kulikov-dev@users.noreply.github.com> Date: Tue, 30 May 2023 15:31:04 +0300 Subject: [PATCH] Update data-validation.md With the validation exception model, it's not clear how to display just message text without stack-trace (just use a DataValidationException class). I found out it only by finding this question: https://github.com/AvaloniaUI/Avalonia/issues/4559 I suggest explaining it in the documentation. --- docs/data-binding/data-validation.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/data-binding/data-validation.md b/docs/data-binding/data-validation.md index 3c62c28..243535d 100644 --- a/docs/data-binding/data-validation.md +++ b/docs/data-binding/data-validation.md @@ -64,6 +64,10 @@ public string? EMail Exceptions inside the getter of your property are not allowed and will result in a crash of your application. {% endhint %} +{% hint style="info"%} +To display just an exception message without stack trace you should use ['DataValidationException'](https://learn.microsoft.com/en-us/dynamicsax-2012/appuser-itpro/datavalidationexception-class-microsoft-dynamics-commerce-runtime) class. +{% endhint %} + ## Customize the appearance of the validation message To display the validation messages, Avalonia has a control called [`DataValidationErrors`](http://reference.avaloniaui.net/api/Avalonia.Controls/DataValidationErrors/). This control is typically placed inside the `ControlTemplate` of all `Controls` that supports data validation, like `TextBox`, `Slider` and other. You can create your own `Style` of the `DataValidationErrors`-control in order to customize the representation of the error messages. @@ -137,4 +141,4 @@ public override void OnFrameworkInitializationCompleted() base.OnFrameworkInitializationCompleted(); } -``` \ No newline at end of file +```