Browse Source
Changed property copy constructors to require same property type.
pull/4648/head
José Pedro
6 years ago
No known key found for this signature in database
GPG Key ID: B8247B9301707B83
2 changed files with
35 additions and
5 deletions
-
src/Avalonia.Base/AvaloniaProperty`1.cs
-
src/Avalonia.Base/DirectPropertyBase.cs
|
|
|
@ -31,18 +31,33 @@ namespace Avalonia |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="AvaloniaProperty"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="AvaloniaProperty{TValue}"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="source">The property to copy.</param>
|
|
|
|
/// <param name="ownerType">The new owner type.</param>
|
|
|
|
/// <param name="metadata">Optional overridden metadata.</param>
|
|
|
|
[Obsolete("Use constructor with AvaloniaProperty<TValue> instead.", true)] |
|
|
|
protected AvaloniaProperty( |
|
|
|
AvaloniaProperty source, |
|
|
|
Type ownerType, |
|
|
|
PropertyMetadata metadata) |
|
|
|
: this(source as AvaloniaProperty<TValue> ?? throw new InvalidOperationException(), ownerType, metadata) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="AvaloniaProperty{TValue}"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="source">The property to copy.</param>
|
|
|
|
/// <param name="ownerType">The new owner type.</param>
|
|
|
|
/// <param name="metadata">Optional overridden metadata.</param>
|
|
|
|
protected AvaloniaProperty( |
|
|
|
AvaloniaProperty source, |
|
|
|
Type ownerType, |
|
|
|
AvaloniaProperty<TValue> source, |
|
|
|
Type ownerType, |
|
|
|
PropertyMetadata metadata) |
|
|
|
: base(source, ownerType, metadata) |
|
|
|
{ |
|
|
|
_changed = source is AvaloniaProperty<TValue> p ? p._changed : new Subject<AvaloniaPropertyChangedEventArgs<TValue>>(); |
|
|
|
_changed = source._changed; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
@ -32,15 +32,30 @@ namespace Avalonia |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="AvaloniaProperty"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="DirectPropertyBase{TValue}"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="source">The property to copy.</param>
|
|
|
|
/// <param name="ownerType">The new owner type.</param>
|
|
|
|
/// <param name="metadata">Optional overridden metadata.</param>
|
|
|
|
[Obsolete("Use constructor with DirectPropertyBase<TValue> instead.", true)] |
|
|
|
protected DirectPropertyBase( |
|
|
|
AvaloniaProperty source, |
|
|
|
Type ownerType, |
|
|
|
PropertyMetadata metadata) |
|
|
|
: this(source as DirectPropertyBase<TValue> ?? throw new InvalidOperationException(), ownerType, metadata) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="DirectPropertyBase{TValue}"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="source">The property to copy.</param>
|
|
|
|
/// <param name="ownerType">The new owner type.</param>
|
|
|
|
/// <param name="metadata">Optional overridden metadata.</param>
|
|
|
|
protected DirectPropertyBase( |
|
|
|
DirectPropertyBase<TValue> source, |
|
|
|
Type ownerType, |
|
|
|
PropertyMetadata metadata) |
|
|
|
: base(source, ownerType, metadata) |
|
|
|
{ |
|
|
|
} |
|
|
|
|