In This Article

Media

The ActiproSoftware.Windows.Media namespace has a UIColor structure that has a lot of helper methods for working with colors and a VisualTreeHelperExtended class that adds some useful methods that aren't in the core VisualTreeHelper class.

General

These general types are found in the namespace:

Type Description

IVisualParent

Provides the base requirements for an element that can add and remove visual child elements.

Note

This interface is used in conjunction with LogicalChildrenCollection.

LinearGradientType

Specifies the type of LinearGradientBrush to be created by LinearGradientBrushExtension.

BrushOpacityConverter Class

BrushOpacityConverter value converter can be used in XAML bindings to return a clone of a Brush with its opacity set to a specified value.

See the Value Converters topic for more information on this class.

ColorInterpolationConverter Class

ColorInterpolationConverter value converter can be used in XAML bindings to return the linear Color value that is the specified percentage between the value of two Color objects.

See the Value Converters topic for more information on this class.

IconFrameConverter Class

IconFrameConverter value converter can be used in binding statements to select an image frame based on its size from an icon (ICO) file. Normally, the first frame from the icon file is returned which may not be the desired size. Using this value converter, a different size frame can be selected regardless of whether it's the first frame.

By default, IconFrameConverter will return the first 32x32 image frame. The desired size can be set using DesiredHeight and DesiredWidth. If no image of the desired size is found, then the passed value is returned.

IconFrameSelector Class

IconFrameSelector markup extension can be used in XAML to select an image frame based on its size from an icon (ICO) file. Normally, the first frame from the icon file is returned which may not be the desired size. Using this markup extension, a different size frame can be selected regardless of whether it's the first frame.

By default, IconFrameSelector will return the first 32x32 image frame. The desired size can be set using DesiredHeight and DesiredWidth. If no image of the desired size is found, then the default ImageSource is returned.

LinearGradientBrushExtension Class

The LinearGradientBrushExtension class implements a markup extension that returns a LinearGradientBrush based on the specified parameters.

These instance members are found in the class:

Member Description

AdditionalStopCount Property

Gets or sets the additional stops used when creating a LinearGradientBrush.

Note

When using additional stops, the start and end color will be alternated at each stop. Therefore if one additional stop is used, then the LinearGradientBrush will have three stops with the colors: start color, end color, start color.

Angle Property

Gets or sets the angle used when creating a LinearGradientBrush. This value is only used when the GradientType is set to CustomAngle.

EndColor Property

Gets or sets the end color of the gradient.

GradientType Property

Gets or sets the type of gradient.

StartColor Property

Gets or sets the start color of the gradient.

These static members are found in the class:

Member Description
CreateBrush Method Creates a LinearGradientBrush based on the specified parameters.

UIColor Structure

The UIColor structure provides an enhanced representation of a Color object that supports the RGB, HSB, and HLS color models, conversion between models, and numerous other color helper methods. Static methods on the structure are used to create an instance of it.

These instance members are found in the structure:

Member Description
A Property Gets or sets the alpha component value of this UIColor structure.
B Property Gets or sets the RGB blue component value of this UIColor structure.
ExceedsW3CBrightnessThreshold Property Gets whether the color exceeds the W3C threshold for brightness.
G Property Gets or sets the RGB green component value of this UIColor structure.
Grayscale Method Converts the color to grayscale.
HlsHue Property Gets or sets the HLS hue component value of this UIColor structure.
HlsLightness Property Gets or sets the HLS lightness component value of this UIColor structure.
HlsSaturation Property Gets or sets the HLS saturation component value of this UIColor structure.
HsbBrightness Property Gets or sets the HSB brightness component value of this UIColor structure.
HsbHue Property Gets or sets the HSB hue component value of this UIColor structure.
HsbSaturation Property Gets or sets the HSB saturation component value of this UIColor structure.
IsGrayscale Property Gets whether the color is grayscale.
Luminance Property Gets the luminance of the color.
R Property Gets or sets the RGB red component value of this UIColor structure.
Tint Method Tints this color towards the specified tint Color.
ToColor Method Gets the Color value of this UIColor structure.
ToWebColor Method Converts the color to a web color string (e.g., "#FF0000" for red).
W3CBrightness Property Gets the brightness of the color, based on the W3C formula for calculating brightness.

These static members are found in the structure, many of which are used to create a UIColor:

Member Description
FromAhls Method Creates a UIColor structure from an alpha value and the specified HLS color values (hue, lightness, and saturation).
FromAhsb Method Creates a UIColor structure from an alpha value and the specified HSB color values (hue, saturation, and brightness).
FromArgb Method Creates a UIColor structure from an alpha value and the specified RGB color values (red, green, and blue).
FromColor Method Creates a UIColor structure from the specified Color.
FromColorComplement Method Creates a UIColor structure from the complement of the specified Color.
FromHls Method Creates a UIColor structure from the specified HLS color values (hue, lightness, and saturation).
FromHsb Method Creates a UIColor structure from the specified HSB color values (hue, saturation, and brightness).
FromMix Method Creates a UIColor structure that is the specified percentage between the value of two Color objects.
FromName Method Creates a UIColor structure from the specified name of a pre-defined color.
FromRgb Method Creates a UIColor structure from the specified RGB color values (red, green, and blue).
FromWebColor Method Creates a UIColor structure from the specified web color. This method can process HTML color specifications (e.g., "#FF00FF") and known color names.
GetStandardCustomColors Method Returns a Color array containing all of the standard custom values.
GetSystemColors Method Returns a Color array containing all of the SystemColors values.
GetTintedColor Method Returns the custom tinted color for the specified base color.
GetWebColors Method Returns an array containing all of the web color values.

VisualTreeHelperExtended Class

The VisualTreeHelperExtended class has several static methods that are useful for performing common tasks with nodes in a visual tree. This class provides some advanced functionality that is not found in the VisualTreeHelper class.

These static members are found in the class:

Member Description
GetAllDescendants Method Returns a list of DependencyObject values that includes all the descendant visual objects that are of the specified Type.
GetAncestor Method Returns a DependencyObject value that represents an ancestor of the visual object that is of the specified Type.
GetAncestorPopup Method Returns a Popup value that represents an ancestor of the visual object.
GetChild Method Returns a DependencyObject value that represents the first child visual object that is of the specified Type.
GetCurrentOrAncestor Method Returns a DependencyObject value that represents the visual object, or an ancestor of the visual object, that is of the specified Type.
GetDescendant Method Includes several overloads that allow a descendent visual to be returned from a specified object using various criteria.
GetFirstDescendant Method Returns a DependencyObject value that represents the first descendant visual object that is of the specified Type.
GetFirstFocusableDescendant Method Returns a UIElement value that represents the first descendant visual object that is focusable.
GetNextFocusable Method Returns a UIElement value that represents the next visual object that is focusable.
GetPreviousFocusable Method Returns a UIElement value that represents the previous visual object that is focusable.
GetRoot Method Returns the root DependencyObject in the visual tree.
IsMouseOver Method Returns whether the bounds of the specified DependencyObject contains the mouse without using a call to IsMouseOver, which can provide inaccurate results in mouse capture scenarios.
IsVisual Method Returns whether the specified DependencyObject is a Visual or Visual3D.