Table of Contents

Class ElementExtention

Namespace
System.Windows
Assembly
H.Extensions.Common.dll
public static class ElementExtention
Inheritance
ElementExtention
Inherited Members

Methods

AddAdorner(UIElement, Adorner)

public static bool AddAdorner(this UIElement element, Adorner adorner)

Parameters

element UIElement
adorner Adorner

Returns

bool

Ancestors(DependencyObject)

public static IEnumerable<DependencyObject> Ancestors(this DependencyObject dependencyObject)

Parameters

dependencyObject DependencyObject

Returns

IEnumerable<DependencyObject>

AncestorsAndSelf(DependencyObject)

public static IEnumerable<DependencyObject> AncestorsAndSelf(this DependencyObject dependencyObject)

Parameters

dependencyObject DependencyObject

Returns

IEnumerable<DependencyObject>

BeginAnimationAngle(UIElement, double, double)

public static void BeginAnimationAngle(this UIElement element, double toAngle, double duration = 1000)

Parameters

element UIElement
toAngle double
duration double

BeginAnimationAngle(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationAngle(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationOpacity(UIElement, double, double)

public static void BeginAnimationOpacity(this UIElement element, double to, double duration = 1000)

Parameters

element UIElement
to double
duration double

BeginAnimationOpacity(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationOpacity(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationPath(UIElement, PathGeometry, double, bool, bool)

public static void BeginAnimationPath(this UIElement element, PathGeometry geometry, double duration = 1000, bool useAngle = true, bool reverse = false)

Parameters

element UIElement
geometry PathGeometry
duration double
useAngle bool
reverse bool

BeginAnimationScale(UIElement, double, double, double)

public static void BeginAnimationScale(this UIElement element, double scaleX, double scaleY, double duration = 1000)

Parameters

element UIElement
scaleX double
scaleY double
duration double

BeginAnimationScaleX(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationScaleX(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationScaleY(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationScaleY(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationSkew(UIElement, double, double, double)

public static void BeginAnimationSkew(this UIElement element, double toAngleX, double toAngleY, double duration = 1000)

Parameters

element UIElement
toAngleX double
toAngleY double
duration double

BeginAnimationSkewX(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationSkewX(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationSkewY(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static void BeginAnimationSkewY(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

BeginAnimationX(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationX(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BeginAnimationXY(UIElement, double, double, double)

public static void BeginAnimationXY(this UIElement element, double toX, double toY, double duration = 1000)

Parameters

element UIElement
toX double
toY double
duration double

BeginAnimationY(UIElement, double, double, double, Action<UIElement>, Action<StoryboardEngineBase>)

public static StoryboardEngineBase BeginAnimationY(this UIElement element, double from, double to, double duration = 1000, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
from double
to double
duration double
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BegionDoubleStoryBoard(UIElement, double, double, double, string, Action<UIElement>, Action<StoryboardEngineBase>)

执行动画

public static StoryboardEngineBase BegionDoubleStoryBoard(this UIElement element, double start, double end, double duration, string propertyName, Action<UIElement> Completed = null, Action<StoryboardEngineBase> init = null)

Parameters

element UIElement
start double
end double
duration double
propertyName string
Completed Action<UIElement>
init Action<StoryboardEngineBase>

Returns

StoryboardEngineBase

BindCommand(UIElement, ICommand)

public static void BindCommand(this UIElement ui, ICommand com)

Parameters

ui UIElement
com ICommand

BindCommand(UIElement, ICommand, Action<object, ExecutedRoutedEventArgs>)

public static void BindCommand(this UIElement ui, ICommand com, Action<object, ExecutedRoutedEventArgs> call)

Parameters

ui UIElement
com ICommand
call Action<object, ExecutedRoutedEventArgs>

CheckDefaultTransformGroup(UIElement)

public static bool CheckDefaultTransformGroup(this UIElement element)

Parameters

element UIElement

Returns

bool

ClearAdorner(UIElement, Predicate<Adorner>)

public static bool ClearAdorner(this UIElement element, Predicate<Adorner> predicate = null)

Parameters

element UIElement
predicate Predicate<Adorner>

Returns

bool

Collapsed(UIElement)

public static void Collapsed(this UIElement ui)

Parameters

ui UIElement

FindAllVisualChild<T>(DependencyObject, Predicate<T>)

public static IEnumerable<T> FindAllVisualChild<T>(this DependencyObject obj, Predicate<T> match) where T : DependencyObject

Parameters

obj DependencyObject
match Predicate<T>

Returns

IEnumerable<T>

Type Parameters

T

GetAdorner(UIElement, Predicate<Adorner>)

public static Adorner GetAdorner(this UIElement element, Predicate<Adorner> predicate = null)

Parameters

element UIElement
predicate Predicate<Adorner>

Returns

Adorner

GetAdorners(UIElement, Predicate<Adorner>)

public static IEnumerable<Adorner> GetAdorners(this UIElement element, Predicate<Adorner> predicate = null)

Parameters

element UIElement
predicate Predicate<Adorner>

Returns

IEnumerable<Adorner>

GetChild<T>(DependencyObject, Func<T, bool>)

public static T GetChild<T>(this DependencyObject p_element, Func<T, bool> p_func = null) where T : UIElement

Parameters

p_element DependencyObject
p_func Func<T, bool>

Returns

T

Type Parameters

T

GetChildren<T>(DependencyObject, Func<T, bool>, bool)

public static IEnumerable<T> GetChildren<T>(this DependencyObject p_element, Func<T, bool> p_func = null, bool filterContain = false) where T : UIElement

Parameters

p_element DependencyObject
p_func Func<T, bool>
filterContain bool

Returns

IEnumerable<T>

Type Parameters

T

GetContent(UIElement)

public static object GetContent(this UIElement element)

Parameters

element UIElement

Returns

object

GetDataContext(UIElement)

public static object GetDataContext(this UIElement element)

Parameters

element UIElement

Returns

object

GetElement<T>(DependencyObject)

public static T GetElement<T>(this DependencyObject element) where T : FrameworkElement

Parameters

element DependencyObject

Returns

T

Type Parameters

T

GetElements<T>(DependencyObject)

public static IEnumerable<T> GetElements<T>(this DependencyObject element) where T : FrameworkElement

Parameters

element DependencyObject

Returns

IEnumerable<T>

Type Parameters

T

GetImage(UIElement)

public static BitmapSource GetImage(this UIElement element)

Parameters

element UIElement

Returns

BitmapSource

GetImplementationRoot(DependencyObject)

public static FrameworkElement GetImplementationRoot(this DependencyObject d)

Parameters

d DependencyObject

Returns

FrameworkElement

GetItemsSource<T>(UIElement)

public static T GetItemsSource<T>(this UIElement element) where T : IEnumerable

Parameters

element UIElement

Returns

T

Type Parameters

T

GetParent(DependencyObject)

public static DependencyObject GetParent(this DependencyObject dependencyObject)

Parameters

dependencyObject DependencyObject

Returns

DependencyObject

GetParent(DependencyObject, Type)

public static DependencyObject GetParent(this DependencyObject fe, Type lookForType)

Parameters

fe DependencyObject
lookForType Type

Returns

DependencyObject

GetParent<T>(DependencyObject)

public static T GetParent<T>(this DependencyObject element) where T : DependencyObject

Parameters

element DependencyObject

Returns

T

Type Parameters

T

GetParent<T>(DependencyObject, Func<T, bool>)

public static T GetParent<T>(this DependencyObject element, Func<T, bool> p_func) where T : DependencyObject

Parameters

element DependencyObject
p_func Func<T, bool>

Returns

T

Type Parameters

T

GetTemplateByName<T>(Control, string)

public static T GetTemplateByName<T>(this Control control, string name) where T : FrameworkElement

Parameters

control Control
name string

Returns

T

Type Parameters

T

GetTransform<T>(UIElement)

获取 RenderTransform 中 Transform 元素

public static T GetTransform<T>(this UIElement element) where T : Transform

Parameters

element UIElement

Returns

T

Type Parameters

T

GetValueSync<T>(DependencyObject, DependencyProperty)

public static T GetValueSync<T>(this DependencyObject obj, DependencyProperty property)

Parameters

obj DependencyObject
property DependencyProperty

Returns

T

Type Parameters

T

Hidden(UIElement)

public static void Hidden(this UIElement ui)

Parameters

ui UIElement

HitTest<T>(UIElement, Geometry, Predicate<T>)

public static T HitTest<T>(this UIElement element, Geometry geometry, Predicate<T> predicate = null) where T : DependencyObject

Parameters

element UIElement
geometry Geometry
predicate Predicate<T>

Returns

T

Type Parameters

T

HitTest<T>(UIElement, Point)

public static T HitTest<T>(this UIElement element, Point point) where T : DependencyObject

Parameters

element UIElement
point Point

Returns

T

Type Parameters

T

HitTest<T>(UIElement, Point, Predicate<T>)

public static T HitTest<T>(this UIElement element, Point point, Predicate<T> predicate = null) where T : DependencyObject

Parameters

element UIElement
point Point
predicate Predicate<T>

Returns

T

Type Parameters

T

PrintLogicalTree(DependencyObject)

public static IEnumerable<DependencyObject> PrintLogicalTree(this DependencyObject obj)

Parameters

obj DependencyObject

Returns

IEnumerable<DependencyObject>

PrintVisualTree(DependencyObject)

public static IEnumerable<DependencyObject> PrintVisualTree(this DependencyObject obj)

Parameters

obj DependencyObject

Returns

IEnumerable<DependencyObject>

SetValueSync<T>(DependencyObject, DependencyProperty, T)

public static void SetValueSync<T>(this DependencyObject obj, DependencyProperty property, T value)

Parameters

obj DependencyObject
property DependencyProperty
value T

Type Parameters

T

TryGetVisualStateGroup(DependencyObject, string)

public static VisualStateGroup TryGetVisualStateGroup(this DependencyObject d, string groupName)

Parameters

d DependencyObject
groupName string

Returns

VisualStateGroup

VisibilityWith(UIElement, bool)

public static void VisibilityWith(this UIElement ui, bool from)

Parameters

ui UIElement
from bool

Visible(UIElement)

public static void Visible(this UIElement ui)

Parameters

ui UIElement

Wait(UIElement, double, Action<UIElement>)

public static void Wait(this UIElement element, double duration = 1000, Action<UIElement> Completed = null)

Parameters

element UIElement
duration double
Completed Action<UIElement>