// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Blazor.Components
{
///
/// Configures options for binding specific element types.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class BindElementAttribute : Attribute
{
///
/// Constructs an instance of .
///
/// The tag name of the element.
/// The suffix value. For example, set this to value for bind-value, or set this to null for bind.
/// The name of the value attribute to be bound.
/// The name of an attribute that will register an associated change event.
public BindElementAttribute(string element, string suffix, string valueAttribute, string changeAttribute)
{
if (element == null)
{
throw new ArgumentNullException(nameof(element));
}
if (valueAttribute == null)
{
throw new ArgumentNullException(nameof(valueAttribute));
}
if (changeAttribute == null)
{
throw new ArgumentNullException(nameof(changeAttribute));
}
Element = element;
ValueAttribute = valueAttribute;
ChangeAttribute = changeAttribute;
}
///
/// Gets the tag name of the element.
///
public string Element { get; }
///
/// Gets the suffix value.
/// For example, this will be value to mean bind-value, or null to mean bind.
///
public string Suffix { get; }
///
/// Gets the name of the value attribute to be bound.
///
public string ValueAttribute { get; }
///
/// Gets the name of an attribute that will register an associated change event.
///
public string ChangeAttribute { get; }
}
}