// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see https://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
using System;
namespace Avalonia.Controls
{
///
/// Provides data for the
///
/// event.
///
public class CalendarDatePickerDateValidationErrorEventArgs : EventArgs
{
private bool _throwException;
///
/// Initializes a new instance of the
///
/// class.
///
///
/// The initial exception from the
///
/// event.
///
///
/// The text that caused the
///
/// event.
///
public CalendarDatePickerDateValidationErrorEventArgs(Exception exception, string text)
{
Text = text;
Exception = exception;
}
///
/// Gets the initial exception associated with the
///
/// event.
///
///
/// The exception associated with the validation failure.
///
public Exception Exception { get; private set; }
///
/// Gets the text that caused the
///
/// event.
///
///
/// The text that caused the validation failure.
///
public string Text { get; private set; }
///
/// Gets or sets a value indicating whether
///
/// should be thrown.
///
///
/// True if the exception should be thrown; otherwise, false.
///
///
/// If set to true and
///
/// is null.
///
public bool ThrowException
{
get => _throwException;
set
{
if (value && Exception == null)
{
throw new ArgumentException("Cannot Throw Null Exception");
}
_throwException = value;
}
}
}
}