From 04d64f537acd909c1ecdbde9051ef597c4b259ec Mon Sep 17 00:00:00 2001 From: heku Date: Fri, 22 Mar 2024 20:10:00 +0800 Subject: [PATCH 1/2] Move IsDirect = true into DirectPropertyBase --- src/Avalonia.Base/DirectProperty.cs | 2 -- src/Avalonia.Base/DirectPropertyBase.cs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/DirectProperty.cs b/src/Avalonia.Base/DirectProperty.cs index ef1b67615f5..3bf8c36d40c 100644 --- a/src/Avalonia.Base/DirectProperty.cs +++ b/src/Avalonia.Base/DirectProperty.cs @@ -32,7 +32,6 @@ internal DirectProperty( { Getter = getter ?? throw new ArgumentNullException(nameof(getter)); Setter = setter; - IsDirect = true; IsReadOnly = setter is null; } @@ -52,7 +51,6 @@ private DirectProperty( { Getter = getter ?? throw new ArgumentNullException(nameof(getter)); Setter = setter; - IsDirect = true; IsReadOnly = setter is null; } diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs index 64eb4d2615f..161e76db091 100644 --- a/src/Avalonia.Base/DirectPropertyBase.cs +++ b/src/Avalonia.Base/DirectPropertyBase.cs @@ -27,6 +27,7 @@ private protected DirectPropertyBase( AvaloniaPropertyMetadata metadata) : base(name, ownerType, ownerType, metadata) { + IsDirect = true; Owner = ownerType; } @@ -42,6 +43,7 @@ private protected DirectPropertyBase( AvaloniaPropertyMetadata metadata) : base(source, ownerType, metadata) { + IsDirect = true; Owner = ownerType; } From 5565135ae2f4e4e4b1c839a82a2737e4e8db3708 Mon Sep 17 00:00:00 2001 From: heku Date: Fri, 22 Mar 2024 21:25:41 +0800 Subject: [PATCH 2/2] Rename IDirectPropertyAccessor.Owner to OwnerType --- src/Avalonia.Base/AvaloniaPropertyRegistry.cs | 2 +- src/Avalonia.Base/DirectPropertyBase.cs | 7 ------- src/Avalonia.Base/IDirectPropertyAccessor.cs | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs index a772f32bf0a..27852653f90 100644 --- a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs +++ b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs @@ -331,7 +331,7 @@ public DirectPropertyBase GetRegisteredDirect( AvaloniaObject o, DirectPropertyBase property) { - if (property.Owner == o.GetType()) + if (property.OwnerType == o.GetType()) { return property; } diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs index 161e76db091..580bd4403be 100644 --- a/src/Avalonia.Base/DirectPropertyBase.cs +++ b/src/Avalonia.Base/DirectPropertyBase.cs @@ -28,7 +28,6 @@ private protected DirectPropertyBase( : base(name, ownerType, ownerType, metadata) { IsDirect = true; - Owner = ownerType; } /// @@ -44,14 +43,8 @@ private protected DirectPropertyBase( : base(source, ownerType, metadata) { IsDirect = true; - Owner = ownerType; } - /// - /// Gets the type that registered the property. - /// - public Type Owner { get; } - /// /// Gets the value of the property on the instance. /// diff --git a/src/Avalonia.Base/IDirectPropertyAccessor.cs b/src/Avalonia.Base/IDirectPropertyAccessor.cs index f92ca1fbf8f..9df25af0643 100644 --- a/src/Avalonia.Base/IDirectPropertyAccessor.cs +++ b/src/Avalonia.Base/IDirectPropertyAccessor.cs @@ -17,7 +17,7 @@ internal interface IDirectPropertyAccessor /// /// Gets the class that registered the property. /// - Type Owner { get; } + Type OwnerType { get; } /// /// Gets the value of the property on the instance.