diff --git a/src/Avalonia.Controls/Documents/TextElement.cs b/src/Avalonia.Controls/Documents/TextElement.cs index e4e5fb8983..1d02161689 100644 --- a/src/Avalonia.Controls/Documents/TextElement.cs +++ b/src/Avalonia.Controls/Documents/TextElement.cs @@ -38,7 +38,8 @@ namespace Avalonia.Controls.Documents AvaloniaProperty.RegisterAttached( nameof(FontSize), defaultValue: 12, - inherits: true); + inherits: true, + validate: fontSize => fontSize > 0 && !double.IsNaN(fontSize) && !double.IsInfinity(fontSize)); /// /// Defines the property.