A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
699 B

using System;
using Avalonia.Controls;
using Avalonia.Data;
#nullable enable
namespace Avalonia.Base.UnitTests.Data.Core;
/// <summary>
/// A <see cref="TextBox"/> which stores the latest binding error state.
/// </summary>
public class ErrorCollectingTextBox : TextBox
{
public Exception? Error { get; private set; }
public BindingValueType ErrorState { get; private set; }
protected override void UpdateDataValidation(AvaloniaProperty property, BindingValueType state, Exception? error)
{
if (property == TextProperty)
{
Error = error;
ErrorState = state;
}
base.UpdateDataValidation(property, state, error);
}
}