Files
skills/propdp-generator/source/OverrideMetadataAttribute.cs

75 lines
2.8 KiB
C#

// internal sealed class OverrideMetadataAttribute : global::System.Attribute
// ... 省略
[global::System.AttributeUsage(global::System.AttributeTargets.Class, AllowMultiple = true)]
[global::System.Diagnostics.Conditional("DEPENDENCY_PROPERTY_GENERATOR_ATTRIBUTES")]
internal sealed class OverrideMetadataAttribute<T> : global::System.Attribute
{
/// <summary>
/// Name of this dependency property.
/// </summary>
public string Name { get; }
/// <summary>
/// Type of this dependency property.
/// </summary>
public global::System.Type Type { get; }
/// <summary>
/// Default value of this dependency property. <br/>
/// If you need to pass a new() expression, use <see cref="DefaultValueExpression"/>. <br/>
/// Default - <see langword="default(type)"/>.
/// </summary>
public object? DefaultValue { get; set; }
/// <summary>
/// Default value expression of this dependency property. <br/>
/// Used to pass a new() expression to an initializer. <br/>
/// Default - <see langword="null"/>.
/// </summary>
public string? DefaultValueExpression { get; set; }
/// <summary>
/// For values other than default(type), will bind/rebind/remove the
/// On{Name}Changed_{EventName}(object sender, Args args) handler for the specified event. <br/>
/// It is recommended to specify as nameof(Control.SomeEvent) or another Avalonia event name. <br/>
/// Default - string.Empty.
/// </summary>
public string BindEvent { get; set; } = string.Empty;
/// <summary>
/// For values other than default(type), will bind/rebind/remove the
/// On{Name}Changed_{EventName}(object sender, Args args) handler for the specified event. <br/>
/// It is recommended to specify as nameof(Control.SomeEvent) or another Avalonia event name. <br/>
/// Default - <see langword="null"/>.
/// </summary>
public string[]? BindEvents { get; set; }
/// <summary>
/// Allows to set a custom name for the OnChanged method call, allowing this method to be non-partial.
/// </summary>
public string OnChanged { get; set; } = string.Empty;
/// <summary>
/// Avalonia: Default BindingMode. <br/>
/// Default - <see cref="DefaultBindingMode.Default"/>.
/// </summary>
public DefaultBindingMode DefaultBindingMode { get; set; } = DefaultBindingMode.Default;
/// <summary>
/// Avalonia: partial method for coerce callback will be created for styled or attached properties.
/// </summary>
public bool Coerce { get; set; }
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <exception cref="global::System.ArgumentNullException"></exception>
public OverrideMetadataAttribute(
string name)
{
Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
Type = typeof(T);
}
}