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

CanCloneDependencyPropertyValue(DependencyObject, DependencyProperty)

Tests if the value of a System.Windows.DependencyProperty can be cloned.

protected virtual bool CanCloneDependencyPropertyValue(DependencyObject source, DependencyProperty dependencyProperty)
Parameter Type Description
source DependencyObject

The source object.

dependencyProperty DependencyProperty

The dependency 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.

GetExplicitlyTransferredDependencyProperties(DependencyObject)

Returns an enumerable of any System.Windows.DependencyProperty which is not automatically transferred from an object.

protected virtual IEnumerable<DependencyProperty> GetExplicitlyTransferredDependencyProperties(DependencyObject source)
Parameter Type Description
source DependencyObject

The source object.

Returns

IEnumerable<DependencyProperty>:

An IEnumerable<T>.

IsTransferableMarkupProperty(object, MarkupProperty)

Tests if a System.Windows.Markup.Primitives.MarkupProperty supports transfer.

protected virtual bool IsTransferableMarkupProperty(object source, MarkupProperty property)
Parameter Type Description
source object

The source object.

property MarkupProperty

The property to examine.

Returns

bool:

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

ResolveTargetDependencyProperty(DependencyObject, DependencyObject, DependencyProperty)

Returns the System.Windows.DependencyProperty of the target which should receive the value of a System.Windows.DependencyProperty on the source.

protected virtual DependencyProperty ResolveTargetDependencyProperty(DependencyObject source, DependencyObject target, DependencyProperty sourceDependencyProperty)
Parameter Type Description
source DependencyObject

The source object.

target DependencyObject

The target object.

sourceDependencyProperty DependencyProperty

The dependency property on the source.

Returns

DependencyProperty:

The System.Windows.DependencyProperty 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.

TransferDependencyProperty(DependencyObject, DependencyObject, DependencyProperty, DependencyProperty)

Transfers the value of a System.Windows.DependencyProperty on the source to a System.Windows.DependencyProperty on the target.

protected virtual void TransferDependencyProperty(DependencyObject source, DependencyObject target, DependencyProperty sourceDependencyProperty, DependencyProperty targetDependencyProperty)
Parameter Type Description
source DependencyObject

The source object.

target DependencyObject

The target object.

sourceDependencyProperty DependencyProperty

The property on the source.

targetDependencyProperty DependencyProperty

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