C# Class SilverFlow.Controls.Extensions.ControlExtensions

Useful WPF/Silverlight controls extensions
显示文件 Open project: Zoomicon/ZUI

Public Methods

Method Description
ContainsPoint ( this element, Point point, UIElement origin = null ) : bool

Determines whether the specified element contains the point.

GetActualBoundingRectangle ( this element ) : Rect

Gets the actual bounding rectangle of the FrameworkElement.

GetPropertyPathForTranslateTransformX ( this element ) : PropertyPath

Gets a PropertyPath for the TranslateTransform.X property.

GetPropertyPathForTranslateTransformY ( this element ) : PropertyPath

Gets a PropertyPath for the TranslateTransform.Y property.

GetRelativePosition ( this element, UIElement rootElement ) : Point

Gets position of the element relative to another specified (root) element.

GetScaleFactorToFit ( this element, double maxWidth, double maxHeight ) : double

Gets scale factor to fit the element to the specified size.

Horizontal ( this thickness ) : double

Gets total horizontal value of the specified thickness.

IsFocused ( this control ) : bool
IsVisible ( this uiElement ) : bool

Determines whether the specified UI element is visible.

IsVisualAncestorOf ( this element, DependencyObject descendent ) : bool
IsVisualDescendentOf ( this element, DependencyObject ancestor ) : bool
MoveToContainer ( this element, FrameworkElement newContainer ) : void

Moves the element to the new container. The container can be a Panel or a Decorator (Border in Silverlight) derived class.

RemoveFromContainer ( this element ) : void

Removes the element from its container. The container can be a Panel or a Decorator (Border in Silverlight) derived class.

SetVisible ( this uiElement, bool visible = true ) : void

Sets the visible of the UIElement.

Vertical ( this thickness ) : double

Gets total vertical value of the specified thickness.

Private Methods

Method Description
GetPropertyPathForTranslateTransform ( this element, string translateBy ) : PropertyPath

Gets a PropertyPath for the TranslateTransform property.

Method Details

ContainsPoint() public static method

Determines whether the specified element contains the point.
public static ContainsPoint ( this element, Point point, UIElement origin = null ) : bool
element this This FrameworkElement.
point Point The point to check.
origin UIElement Relative origin (optional).
return bool

GetActualBoundingRectangle() public static method

Gets the actual bounding rectangle of the FrameworkElement.
public static GetActualBoundingRectangle ( this element ) : Rect
element this The element.
return System.Windows.Rect

GetPropertyPathForTranslateTransformX() public static method

Gets a PropertyPath for the TranslateTransform.X property.
public static GetPropertyPathForTranslateTransformX ( this element ) : PropertyPath
element this The element.
return System.Windows.PropertyPath

GetPropertyPathForTranslateTransformY() public static method

Gets a PropertyPath for the TranslateTransform.Y property.
public static GetPropertyPathForTranslateTransformY ( this element ) : PropertyPath
element this The element.
return System.Windows.PropertyPath

GetRelativePosition() public static method

Gets position of the element relative to another specified (root) element.
Input parameter is null.
public static GetRelativePosition ( this element, UIElement rootElement ) : Point
element this The element.
rootElement UIElement The root element.
return Point

GetScaleFactorToFit() public static method

Gets scale factor to fit the element to the specified size.
public static GetScaleFactorToFit ( this element, double maxWidth, double maxHeight ) : double
element this The element to scale.
maxWidth double Maximal width of the element.
maxHeight double Maximal height of the element.
return double

Horizontal() public static method

Gets total horizontal value of the specified thickness.
Input parameter is null.
public static Horizontal ( this thickness ) : double
thickness this The thickness.
return double

IsFocused() public static method

public static IsFocused ( this control ) : bool
control this
return bool

IsVisible() public static method

Determines whether the specified UI element is visible.
public static IsVisible ( this uiElement ) : bool
uiElement this The UI element.
return bool

IsVisualAncestorOf() public static method

public static IsVisualAncestorOf ( this element, DependencyObject descendent ) : bool
element this
descendent System.Windows.DependencyObject
return bool

IsVisualDescendentOf() public static method

public static IsVisualDescendentOf ( this element, DependencyObject ancestor ) : bool
element this
ancestor System.Windows.DependencyObject
return bool

MoveToContainer() public static method

Moves the element to the new container. The container can be a Panel or a Decorator (Border in Silverlight) derived class.
New Container is null.
public static MoveToContainer ( this element, FrameworkElement newContainer ) : void
element this The element.
newContainer System.Windows.FrameworkElement The new container of the element.
return void

RemoveFromContainer() public static method

Removes the element from its container. The container can be a Panel or a Decorator (Border in Silverlight) derived class.
public static RemoveFromContainer ( this element ) : void
element this The element.
return void

SetVisible() public static method

Sets the visible of the UIElement.
public static SetVisible ( this uiElement, bool visible = true ) : void
uiElement this The UI element.
visible bool Set Visible if true; otherwise - Collapsed.
return void

Vertical() public static method

Gets total vertical value of the specified thickness.
Input parameter is null.
public static Vertical ( this thickness ) : double
thickness this The thickness.
return double