New to Telerik UI for WPFStart a free 30-day trial

This class contains extension methods for layout operations in Telerik Windows Documents.

Definition

Namespace:Telerik.Windows.Documents.Layout

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public static class ExtensionMethods

Inheritance: objectExtensionMethods

Methods

Adds the width of two Size instances.

C#
public static Size AddWidth(this Size size1, Size size2)
Parameters:size1Size

The first Size instance to be added.

size2Size

The second Size instance to be added.

Returns:

Size

A new Size instance that represents the total width of the two input sizes.

Determines whether two RectangleF instances are close to each other, based on their dimensions and positions.

C#
public static bool AreClose(this RectangleF rect1, RectangleF rect2)
Parameters:rect1RectangleF

The first rectangle to compare.

rect2RectangleF

The second rectangle to compare.

Returns:

bool

True if the two rectangles are considered close; otherwise, false.

Blends two colors together using a specified blending algorithm.

C#
public static Color BlendWith(this Color color, Color backColor)
Parameters:colorColor

The first color to blend.

backColorColor

The second color to blend.

Returns:

Color

A new color that is the result of blending color and backColor.

Darkens the specified color by a given amount.

C#
public static Color Darker(this Color color, byte factor)
Parameters:colorColor

The color to be darkened.

factorbyte

The amount by which to darken the color, represented as a byte value.

Returns:

Color

A new color that is darker than the original color.

Darkens the specified color by a certain factor.

C#
public static Color Darker(this Color color)
Parameters:colorColor

The color to be darkened.

Returns:

Color

A new Color that is a darker version of the specified color.

Retrieves the associated layout box for the specified UI element.

C#
public static LayoutBox GetAssociatedLayoutBox(this UIElement element)
Parameters:elementUIElement

The UI element to retrieve the associated layout box for.

Returns:

LayoutBox

The associated layout box of type T if found; otherwise, null.

Retrieves the current section box for the specified layout box.

C#
public static SectionLayoutBox GetCurrentSectionBox(this LayoutBox box)
Parameters:boxLayoutBox

The layout box from which to obtain the current section box.

Returns:

SectionLayoutBox

Returns the current section box associated with the provided layout box.

Retrieves an element of type T from the specified hierarchical index within the given RadDocument.

C#
public static T GetElement<T>(this HierarchicalIndex index, RadDocument document) where T : DocumentElement
Parameters:indexHierarchicalIndex

The hierarchical index from which to retrieve the element.

documentRadDocument

The RadDocument that contains the elements.

Returns:

T

A value of type T representing the retrieved element, or the default value of T if not found.

Retrieves the location of a specified rectangle within the layout.

C#
public static Point GetLocation(this Rect rect)
Parameters:rectRect

The rectangle whose location is to be retrieved.

Returns:

Point

A Point representing the location of the specified rectangle.

Calculates the size of the specified rectangle.

C#
public static Size GetSize(this Rect rect)
Parameters:rectRect

The rectangle for which to calculate the size.

Returns:

Size

A Size object representing the width and height of the rectangle.

Determines whether two rectangles intersect with each other.

C#
public static bool IntersectsWith(this Rect rect, Rect rect1)
Parameters:rectRect

The first rectangle to check for intersection.

rect1Rect

The second rectangle to check for intersection.

Returns:

bool

True if the two rectangles intersect; otherwise, false.

Adjusts the brightness of the specified color by a certain amount.

C#
public static Color Lighter(this Color color, byte factor)
Parameters:colorColor

The color to be lightened.

factorbyte

The amount by which to lighten the color. A positive value increases brightness.

Returns:

Color

A new Color that is lighter than the original color by the specified amount.

Creates a lighter version of the specified Color.

C#
public static Color Lighter(this Color color)
Parameters:colorColor

The Color to be lightened.

Returns:

Color

A new Color that is lighter than the original color.

Converts the specified color to a lighter shade using the HSL (Hue, Saturation, Lightness) method.

C#
public static Color LighterUsingHsl(this Color color)
Parameters:colorColor

The color to be lightened.

Returns:

Color

A Color object representing the lighter shade of the specified color.

Retrieves and removes the object at the front of the specified queue, or returns the default value if the queue is empty.

C#
public static T ProbeDequeue<T>(this Queue<T> queue)
Parameters:queueQueue<T>

The queue from which to dequeue the object.

Returns:

T

The object at the front of the queue if available; otherwise, the default value for the type T.

Examines the top element of the specified stack without removing it, providing a way to check the value at the top without modifying the stack's state.

C#
public static T ProbePeek<T>(this Stack<T> stack)
Parameters:stackStack<T>

The stack from which to probe the top element.

Returns:

T

The top element of the stack if it exists; otherwise, the default value of type T.

Probes the specified stack of type T and retrieves the top element without removing it.

C#
public static T ProbePop<T>(this Stack<T> stack)
Parameters:stackStack<T>

The stack from which to probe the top element.

Returns:

T

The top element of the stack if it exists; otherwise, the default value of type T.

Sets the associated layout box for the specified UI element.

C#
public static void SetAssociatedLayoutBox(this UIElement element, LayoutBox value)
Parameters:elementUIElement

The UI element to associate with the layout box.

valueLayoutBox

The layout box to be associated with the UI element.

Sets the source of the specified BitmapImage from the given Stream.

C#
public static void SetSource(this BitmapImage bitmapImage, Stream imageStream)
Parameters:bitmapImageBitmapImage

The BitmapImage to which the source will be set.

imageStreamStream

The Stream that contains the image data.

Sets the source of a BitmapImage using a byte array and updates a reference string.

C#
public static byte[] SetSourceEx(this BitmapImage bitmapImage, byte[] imageBytes, ref string extension)
Parameters:bitmapImageBitmapImage

The BitmapImage to set the source for.

imageBytesbyte[]

The byte array representing the source data.

extensionstring

A reference string that may be modified by the method.

Returns:

byte[]

A boolean value indicating whether the operation was successful.

Sets the source of the specified BitmapImage from the given Stream, updating the provided string reference if necessary.

C#
public static Stream SetSourceEx(this BitmapImage bitmapImage, Stream imageStream, ref string extension)
Parameters:bitmapImageBitmapImage

The BitmapImage to set the source for.

imageStreamStream

The Stream containing the image data.

extensionstring

A reference to a string that can be updated with the new image extension.

Returns:

Stream

Returns true if the source was successfully set, otherwise returns false.

Splits the input string into two parts based on the specified delimiter.

C#
public static string[] Split(this string input, string separator)
Parameters:inputstring

The string to be split.

separatorstring

The string that delimits the split.

Returns:

string[]

A tuple containing the two segments of the split string.

Converts a Thickness instance to a padding format suitable for layout purposes.

C#
public static Padding ToPadding(this Thickness thickness)
Parameters:thicknessThickness

A Thickness structure that defines the padding values.

Returns:

Padding

A Thickness instance representing the padding in the layout.

Converts a PointF to a point representation used in layout.

C#
public static Point ToPoint(this PointF point)
Parameters:pointPointF

The PointF instance to be converted.

Returns:

Point

A point representation of the provided PointF.

Converts a Point to a PointF representation.

C#
public static PointF ToPointF(this Point point)
Parameters:pointPoint

The Point to be converted.

Returns:

PointF

A PointF that represents the specified Point.

Converts a RectangleF to a Rect.

C#
public static Rect ToRect(this RectangleF rectangle)
Parameters:rectangleRectangleF

The rectangle to be converted.

Returns:

Rect

A Rect that represents the converted rectangle.

Converts a Rect to a RectangleF.

C#
public static RectangleF ToRectangleF(this Rect rectangle)
Parameters:rectangleRect

The Rect instance to be converted.

Returns:

RectangleF

A RectangleF that represents the converted rectangle.

Converts a Size structure to a SizeF structure.

C#
public static SizeF ToSizeF(this Size size)
Parameters:sizeSize

The Size structure to be converted.

Returns:

SizeF

A SizeF structure that represents the converted size.

Converts a Padding instance into a Thickness instance.

C#
public static Thickness ToThickness(this Padding padding)
Parameters:paddingPadding

The padding to convert.

Returns:

Thickness

A Thickness that represents the converted padding.