fix: fix AllowHalf initialization.
This commit is contained in:
@@ -179,16 +179,13 @@ public class Rating : TemplatedControl
|
|||||||
Items.Add(new RatingCharacter());
|
Items.Add(new RatingCharacter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var item in Items)
|
||||||
|
{
|
||||||
|
item.AllowHalf = AllowHalf;
|
||||||
|
}
|
||||||
SetCurrentValue(ValueProperty, DefaultValue);
|
SetCurrentValue(ValueProperty, DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoaded(RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnLoaded(e);
|
|
||||||
UpdateItemsByValue(Value);
|
|
||||||
AdjustWidth(Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Preview(RatingCharacter o)
|
public void Preview(RatingCharacter o)
|
||||||
{
|
{
|
||||||
var index = Items.IndexOf(o);
|
var index = Items.IndexOf(o);
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ public class RatingCharacter : TemplatedControl
|
|||||||
|
|
||||||
private Control? _icon;
|
private Control? _icon;
|
||||||
|
|
||||||
public static readonly StyledProperty<bool> AllowHalfProperty = AvaloniaProperty.Register<RatingCharacter, bool>(
|
public static readonly StyledProperty<bool> AllowHalfProperty = Rating.AllowHalfProperty.AddOwner<RatingCharacter>();
|
||||||
nameof(AllowHalf));
|
|
||||||
|
|
||||||
|
|
||||||
public bool AllowHalf
|
public bool AllowHalf
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user