In This Article

FrameworkElementExtensions Class

Provides extension methods for the type FrameworkElement.

public static class FrameworkElementExtensions
Object Object


AnimateDoubleProperty(FrameworkElement, String, Double, Double, Double, Nullable<Double>, Nullable<Double>)

Animates a Double-based property to a value.

public static void AnimateDoubleProperty(this FrameworkElement element, string propertyPath, double targetValue, double duration = 0.2, double startTime = 0, double? finalValue = default(double? ), double? initialValue = default(double? ))
Parameter Type Description
element FrameworkElement

The FrameworkElement to examine.

propertyPath String

The property path.

targetValue Double

The target value.

duration Double

The duration.

startTime Double

The start time.

finalValue Nullable<Double>

The optional final value.

initialValue Nullable<Double>

The optional initial value.

BindToProperty(FrameworkElement, DependencyProperty, Object, String, BindingMode, IValueConverter, Object)

Binds a dependency property to a property on the specified source.

public static void BindToProperty(this FrameworkElement element, DependencyProperty targetProperty, object source, string sourcePropertyName, BindingMode mode, IValueConverter converter = null, object converterParameter = null)
Parameter Type Description
element FrameworkElement

The target element.

targetProperty DependencyProperty

The target property.

source Object

The source object.

sourcePropertyName String

The source property name.

mode BindingMode

The binding mode.

converter IValueConverter

The value converter.

converterParameter Object

The value converter parameter.


Returns the element's current size.

public static Size GetCurrentSize(this FrameworkElement element)
Parameter Type Description
element FrameworkElement

The element to examine.



The element's current size.


This method looks at the ActualWidth and ActualHeight properties for the size. If those haven't yet been set, the Width and Height properties are examined.

Inherited Members