using Avalonia.Controls;
using Avalonia.LogicalTree;
namespace Artemis.UI.Shared.Extensions
{
///
/// Provides extension methods for Avalonia's type
///
public static class ControlExtensions
{
///
/// Clears all data validation errors on the given control and any of it's logical siblings
///
/// The target control
public static void ClearAllDataValidationErrors(this Control target)
{
DataValidationErrors.ClearErrors(target);
foreach (ILogical logicalChild in target.GetLogicalChildren())
{
if (logicalChild is Control childControl)
childControl.ClearAllDataValidationErrors();
}
}
}
}