In This Article

CloneServiceBase Class

Provide a default implementation of ICloneService which can be used to create clones of objects.

public abstract class CloneServiceBase : ICloneService
Inheritance:
object object
Derived:
BarsCloneService
Implements:
ICloneService

Constructors

CloneServiceBase()

Initializes a new instance of the CloneServiceBase class.

public CloneServiceBase()

Methods

CanCloneAvaloniaPropertyValue(AvaloniaObject, AvaloniaProperty)

Tests if the value of an Avalonia.AvaloniaProperty can be cloned.

protected virtual bool CanCloneAvaloniaPropertyValue(AvaloniaObject source, AvaloniaProperty property)
Parameter Type Description
source AvaloniaObject

The source object.

property AvaloniaProperty

The property to be tested.

Returns

bool:

true if the value can be cloned; otherwise false to skip cloning the value.

CreateClone(object?)

Returns a clone of the original object.

public object? CreateClone(object? original)
Parameter Type Description
original object

The original object to be cloned.

Returns

object:

A clone of the original object when possible. Otherwise, null or the original object is returned (depending on settings).

CreateClone(object?, CloneOptions)

Returns a clone of the original object.

public object? CreateClone(object? original, CloneOptions options)
Parameter Type Description
original object

The original object to be cloned.

options CloneOptions

The options to use when cloning.

Returns

object:

A clone of the original object when possible. Otherwise, null or the original object is returned (depending on settings).

CreateCloneCore(object?, CloneOptions?, Type?)

Performs the core logic of cloning an object.

protected virtual object? CreateCloneCore(object? original, CloneOptions? options, Type? defaultType)
Parameter Type Description
original object

The original object to be cloned.

options CloneOptions

The options to use when cloning. When not specified, default options will be used.

defaultType Type

Optionally defines the default type of object to be created when not specified by options.

Returns

object:

A clone of the original object when possible. Otherwise, null or the original object is returned (depending on settings).

CreateClone<T>(object?)

Returns a clone of the original object.

public T? CreateClone<T>(object? original) where T : class
Type Parameters:
T -

The type of the cloned object.

Parameter Type Description
original object

The original object to be cloned.

Returns

T:

A clone of the original object when possible. Otherwise, null or the original object is returned (depending on settings).

CreateClone<T>(object?, CloneOptions)

Returns a clone of the original object.

public T? CreateClone<T>(object? original, CloneOptions options) where T : class
Type Parameters:
T -

The type of the cloned object.

Parameter Type Description
original object

The original object to be cloned.

options CloneOptions

The options to use when cloning.

Returns

T:

A clone of the original object when possible. Otherwise, null or the original object is returned (depending on settings).

CreateInstance(object?, CloneOptions?, Type?)

Creates the base instance of an object which is the clone of another object.

protected virtual object? CreateInstance(object? original, CloneOptions? options, Type? defaultType)
Parameter Type Description
original object

The original object to be cloned.

options CloneOptions

The options to use when cloning.

defaultType Type

Optionally defines the default type of object to be created when not specified by options.

Returns

object:

A new instance of an object if available; otherwise null if an instance could not be created.

GetAvaloniaProperties(AvaloniaObject)

Returns an enumerable of any Avalonia.AvaloniaProperty instances defined for a given object.

protected virtual IEnumerable<AvaloniaProperty> GetAvaloniaProperties(AvaloniaObject source)
Parameter Type Description
source AvaloniaObject

The source object.

Returns

IEnumerable<AvaloniaProperty>:

An IEnumerable<T>.

See Also

GetProperties(object)

Returns an enumerable of any PropertyDescriptor instances defined for a given object.

protected virtual IEnumerable<PropertyDescriptor> GetProperties(object source)
Parameter Type Description
source object

The source object.

Returns

IEnumerable<PropertyDescriptor>:

An IEnumerable<T>.

See Also

IsPropertyExplicitlyAssigned(AvaloniaObject, AvaloniaProperty)

Tests if the value of an Avalonia.AvaloniaProperty has been explicitly assigned a value on a given object.

protected virtual bool IsPropertyExplicitlyAssigned(AvaloniaObject source, AvaloniaProperty property)
Parameter Type Description
source AvaloniaObject

The source object to examine.

property AvaloniaProperty

The property to test.

Returns

bool:

true if the property value has been explicitly assigned; otherwise, false.

IsTransferableProperty(object, PropertyDescriptor)

Tests if a PropertyDescriptor supports transfer.

protected virtual bool IsTransferableProperty(object source, PropertyDescriptor property)
Parameter Type Description
source object

The source object.

property PropertyDescriptor

The property to examine.

Returns

bool:

true if the property can be transferred; otherwise false if it cannot be transferred.

IsTransferableProperty(object, object, AvaloniaProperty)

Tests if an Avalonia.AvaloniaProperty supports transfer.

protected virtual bool IsTransferableProperty(object source, object target, AvaloniaProperty property)
Parameter Type Description
source object

The source object.

target object

The target object.

property AvaloniaProperty

The property to examine.

Returns

bool:

true if the property can be transferred; otherwise false if it cannot be transferred.

ResolveTargetAvaloniaProperty(AvaloniaObject, AvaloniaObject, AvaloniaProperty)

Returns the Avalonia.AvaloniaProperty of the target which should receive the value of a Avalonia.AvaloniaProperty on the source.

protected virtual AvaloniaProperty? ResolveTargetAvaloniaProperty(AvaloniaObject source, AvaloniaObject target, AvaloniaProperty sourceProperty)
Parameter Type Description
source AvaloniaObject

The source object.

target AvaloniaObject

The target object.

sourceProperty AvaloniaProperty

The property on the source.

Returns

AvaloniaProperty:

The Avalonia.AvaloniaProperty to be used by the target; otherwise null if a target property is unavailable.

ResolveTargetProperty(object, object, PropertyDescriptor)

Returns the PropertyDescriptor of the target which should receive the value of a PropertyDescriptor on the source.

protected virtual PropertyDescriptor? ResolveTargetProperty(object source, object target, PropertyDescriptor sourceProperty)
Parameter Type Description
source object

The source object.

target object

The target object.

sourceProperty PropertyDescriptor

The property on the source.

Returns

PropertyDescriptor:

The PropertyDescriptor to be used by the target; otherwise null if a target property is unavailable.

TransferAvaloniaProperty(AvaloniaObject, AvaloniaObject, AvaloniaProperty, AvaloniaProperty?)

Transfers the value of a Avalonia.AvaloniaProperty on the source to a Avalonia.AvaloniaProperty on the target.

protected virtual void TransferAvaloniaProperty(AvaloniaObject source, AvaloniaObject target, AvaloniaProperty sourceProperty, AvaloniaProperty? targetProperty)
Parameter Type Description
source AvaloniaObject

The source object.

target AvaloniaObject

The target object.

sourceProperty AvaloniaProperty

The property on the source.

targetProperty AvaloniaProperty

The property on the target.

TransferProperty(object, object, PropertyDescriptor?, PropertyDescriptor?)

Transfers the value of a property from the source to the target.

protected virtual void TransferProperty(object source, object target, PropertyDescriptor? sourcePropertyDescriptor, PropertyDescriptor? targetPropertyDescriptor)
Parameter Type Description
source object

The source object.

target object

The target object.

sourcePropertyDescriptor PropertyDescriptor

The PropertyDescriptor of the property on the source.

targetPropertyDescriptor PropertyDescriptor

The PropertyDescriptor of the property on the target.

Inherited Members

Extension Methods