diff --git a/src/Avalonia.Base/AvaloniaProperty`1.cs b/src/Avalonia.Base/AvaloniaProperty`1.cs
index 7480d9c9c5..d5549e979b 100644
--- a/src/Avalonia.Base/AvaloniaProperty`1.cs
+++ b/src/Avalonia.Base/AvaloniaProperty`1.cs
@@ -31,18 +31,33 @@ namespace Avalonia
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
+ ///
+ /// The property to copy.
+ /// The new owner type.
+ /// Optional overridden metadata.
+ [Obsolete("Use constructor with AvaloniaProperty instead.", true)]
+ protected AvaloniaProperty(
+ AvaloniaProperty source,
+ Type ownerType,
+ PropertyMetadata metadata)
+ : this(source as AvaloniaProperty ?? throw new InvalidOperationException(), ownerType, metadata)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
///
/// The property to copy.
/// The new owner type.
/// Optional overridden metadata.
protected AvaloniaProperty(
- AvaloniaProperty source,
- Type ownerType,
+ AvaloniaProperty source,
+ Type ownerType,
PropertyMetadata metadata)
: base(source, ownerType, metadata)
{
- _changed = source is AvaloniaProperty p ? p._changed : new Subject>();
+ _changed = source._changed;
}
///
diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs
index dbc2625b86..a2f113adb7 100644
--- a/src/Avalonia.Base/DirectPropertyBase.cs
+++ b/src/Avalonia.Base/DirectPropertyBase.cs
@@ -32,15 +32,30 @@ namespace Avalonia
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The property to copy.
/// The new owner type.
/// Optional overridden metadata.
+ [Obsolete("Use constructor with DirectPropertyBase instead.", true)]
protected DirectPropertyBase(
AvaloniaProperty source,
Type ownerType,
PropertyMetadata metadata)
+ : this(source as DirectPropertyBase ?? throw new InvalidOperationException(), ownerType, metadata)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The property to copy.
+ /// The new owner type.
+ /// Optional overridden metadata.
+ protected DirectPropertyBase(
+ DirectPropertyBase source,
+ Type ownerType,
+ PropertyMetadata metadata)
: base(source, ownerType, metadata)
{
}