feat: add property Size.
This commit is contained in:
@@ -38,6 +38,9 @@ public class Rating : TemplatedControl
|
||||
public static readonly StyledProperty<double> DefaultValueProperty =
|
||||
AvaloniaProperty.Register<Rating, double>(nameof(DefaultValue));
|
||||
|
||||
public static readonly StyledProperty<double> SizeProperty =
|
||||
AvaloniaProperty.Register<RatingCharacter, double>(nameof(Size));
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> ItemTemplateProperty =
|
||||
AvaloniaProperty.Register<Rating, IDataTemplate?>(nameof(ItemTemplate));
|
||||
|
||||
@@ -83,6 +86,12 @@ public class Rating : TemplatedControl
|
||||
set => SetValue(DefaultValueProperty, value);
|
||||
}
|
||||
|
||||
public double Size
|
||||
{
|
||||
get => GetValue(SizeProperty);
|
||||
set => SetValue(SizeProperty, value);
|
||||
}
|
||||
|
||||
public IDataTemplate? ItemTemplate
|
||||
{
|
||||
get => GetValue(ItemTemplateProperty);
|
||||
@@ -137,7 +146,8 @@ public class Rating : TemplatedControl
|
||||
Items.Add(new RatingCharacter
|
||||
{
|
||||
Character = Character,
|
||||
AllowHalf = AllowHalf
|
||||
AllowHalf = AllowHalf,
|
||||
Size = Size,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -174,7 +184,8 @@ public class Rating : TemplatedControl
|
||||
Items.Add(new RatingCharacter
|
||||
{
|
||||
Character = Character,
|
||||
AllowHalf = AllowHalf
|
||||
AllowHalf = AllowHalf,
|
||||
Size = Size,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public class RatingCharacter : TemplatedControl
|
||||
public static readonly StyledProperty<object> CharacterProperty =
|
||||
Rating.CharacterProperty.AddOwner<RatingCharacter>();
|
||||
|
||||
public static readonly StyledProperty<double> SizeProperty =
|
||||
Rating.SizeProperty.AddOwner<RatingCharacter>();
|
||||
|
||||
public bool AllowHalf
|
||||
{
|
||||
get => GetValue(AllowHalfProperty);
|
||||
@@ -35,6 +38,12 @@ public class RatingCharacter : TemplatedControl
|
||||
set => SetValue(CharacterProperty, value);
|
||||
}
|
||||
|
||||
public double Size
|
||||
{
|
||||
get => GetValue(SizeProperty);
|
||||
set => SetValue(SizeProperty, value);
|
||||
}
|
||||
|
||||
internal bool IsLast { get; set; }
|
||||
|
||||
private bool _isHalf;
|
||||
|
||||
Reference in New Issue
Block a user