Skip to content

ElementExtensions class

Fluent API extension methods for FrameworkElement.

Guide: C# Markup guide

public static class ElementExtensions
name description
static Bottom<T>(…) Aligns the element to the bottom.
static Cached<T>(…) Enables (or disables) bitmap caching of the element’s rendered output. The cached bitmap is blitted each frame until the element’s content, size, or DPI changes; the visual tree stays live. Equivalent to assigning a BitmapCache to CacheMode.
static CanvasBottom<T>(…) Sets the canvas bottom position.
static CanvasLeft<T>(…) Sets the canvas left position.
static CanvasPosition<T>(…) Sets the canvas position.
static CanvasRight<T>(…) Sets the canvas right position.
static CanvasTop<T>(…) Sets the canvas top position.
static Center<T>(…) Centers the element horizontally and vertically.
static CenterHorizontal<T>(…) Centers the element horizontally.
static CenterVertical<T>(…) Centers the element vertically.
static Column<T>(…) Sets the grid column.
static ColumnSpan<T>(…) Sets the grid column span.
static Cursor<T>(…) Sets the cursor type.
static DockBottom<T>(…) Docks the element to the bottom.
static DockLeft<T>(…) Docks the element to the left.
static DockRight<T>(…) Docks the element to the right.
static DockTo<T>(…) Sets the dock position.
static DockTop<T>(…) Docks the element to the top.
static FitContentHeight<TWindow>(…) Sets the window to fit content height.
static FitContentSize<TWindow>(…) Sets the window to fit content size.
static FitContentWidth<TWindow>(…) Sets the window to fit content width.
static Fixed<TWindow>(…) Sets the window as fixed size.
static FullScreen<T>(…) Puts the window into fullscreen, or restores it to normal when value is false.
static GridPosition<T>(…) Sets the grid position. (2 methods)
static Left<T>(…) Aligns the element to the left.
static Margin<T>(…) Sets the margin uniformly. (3 methods)
static Maximized<T>(…) Sets the window state to maximized.
static Minimized<T>(…) Sets the window state to minimized.
static OnLayoutSizeChanged<T>(…) Adds a size change handler.
static Padding<T>(…) Sets the padding uniformly. (3 methods)
static Register<T>(…) Registers an element by name in a template context.
static Resizable<TWindow>(…) Sets the window as resizable with optional min/max constraints.
static Right<T>(…) Aligns the element to the right.
static Row<T>(…) Sets the grid row.
static RowSpan<T>(…) Sets the grid row span.
static Size<T>(…) Sets the size. (2 methods)
static StartCenterOwner(…) Sets the window to open centered on the owner window. The owner is provided when calling Show or ShowDialogAsync.
static StartCenterScreen<TWindow>(…) Sets the window to open centered on the primary screen. Must be called before Show.
static StartManualPosition(…) Sets the window to open at the specified position in DIPs (primary monitor DPI basis). Must be called before Show.
static StretchHorizontal<T>(…) Stretches the element horizontally.
static StretchVertical<T>(…) Stretches the element vertically.
static Top<T>(…) Aligns the element to the top.