feat: optimize.

This commit is contained in:
Zhang Dian
2024-06-03 17:39:50 +08:00
parent ceede38804
commit f000c68597
5 changed files with 24 additions and 39 deletions

View File

@@ -8,19 +8,11 @@ namespace Ursa.Controls;
[PseudoClasses(PC_Selected)]
[TemplatePart(PART_IconGlyph, typeof(PathIcon))]
public class RatingCharacter : ContentControl
public class RatingCharacter : TemplatedControl
{
public const string PART_IconGlyph = "PART_IconGlyph";
protected const string PC_Selected = ":selected";
private PathIcon? _icon;
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
_icon = e.NameScope.Find<PathIcon>(PART_IconGlyph);
}
protected override void OnPointerEntered(PointerEventArgs e)
{
var parent = this.GetLogicalAncestors().OfType<Rating>().FirstOrDefault();