-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The current approach is to declare a field that is basically useless for StyledProperty. What I would prefer is having an attribute that is placed on the containing class, which declares the type and the name of the property and the StyledProperty field.
For example,
[AvaStyledProperty<double>(nameof(MinValue))]
[AvaStyledProperty<double>(nameof(MaxValue))]
[AvaStyledProperty<double>(nameof(CurrentValue))]
public partial class ExampleControl : UserControl
{
}Generating:
partial class ExampleControl
{
public static readonly StyledProperty<double> MinValueProperty =
AvaloniaProperty.Register<ExampleControl, double>(nameof(MinValue));
public double MinValue
{
get => GetValue(MinValueProperty);
set
{
SetValue(MinValueProperty, value);
}
}
public static readonly StyledProperty<double> MaxValueProperty =
AvaloniaProperty.Register<ExampleControl, double>(nameof(MaxValue));
public double MaxValue
{
get => GetValue(MaxValueProperty);
set
{
SetValue(MaxValueProperty, value);
}
}
public static readonly StyledProperty<double> CurrentValueProperty =
AvaloniaProperty.Register<ExampleControl, double>(nameof(CurrentValue));
public double CurrentValue
{
get => GetValue(CurrentValueProperty);
set
{
SetValue(CurrentValueProperty, value);
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels