In This Article

FrameworkElementExtensions Class

Provides extension methods for the type System.Windows.FrameworkElement.

public static class FrameworkElementExtensions
Inheritance:
System.Object Object

Methods

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 System.Windows.FrameworkElement

The System.Windows.FrameworkElement to examine.

propertyPath System.String

The property path.

targetValue System.Double

The target value.

duration System.Double

The duration.

startTime System.Double

The start time.

finalValue System.Nullable<System.Double>

The optional final value.

initialValue System.Nullable<System.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 System.Windows.FrameworkElement

The target element.

targetProperty System.Windows.DependencyProperty

The target property.

source System.Object

The source object.

sourcePropertyName System.String

The source property name.

mode BindingMode

The binding mode.

converter System.Windows.Data.IValueConverter

The value converter.

converterParameter System.Object

The value converter parameter.

BindToProperty(FrameworkElement, DependencyProperty, Object, DependencyProperty, 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, DependencyProperty sourceProperty, BindingMode mode, IValueConverter converter = null, object converterParameter = null)
Parameter Type Description
element System.Windows.FrameworkElement

The target element.

targetProperty System.Windows.DependencyProperty

The target property.

source System.Object

The source object.

sourceProperty System.Windows.DependencyProperty

The source property.

mode BindingMode

The binding mode.

converter System.Windows.Data.IValueConverter

The value converter.

converterParameter System.Object

The value converter parameter.

GetCurrentSize(FrameworkElement)

Returns the element's current size.

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

The element to examine.

Returns

System.Windows.Size:

The element's current size.

Remarks

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

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()