In This Article

CustomDrawElement Class

Represents a UIElement that is capable of being custom drawn via the handling of its CustomDraw event.

public class CustomDrawElement : FrameworkElement
Inheritance:
object Visual UIElement FrameworkElement object

Constructors

CustomDrawElement()

Initializes an instance of the class.

public CustomDrawElement()

Methods

GetLayoutClip(Size?)

Returns a geometry for a clipping mask. The mask applies if the layout system attempts to arrange an element that is larger than the available display space.

protected override Geometry? GetLayoutClip(Size? layoutSlotSize)
Parameter Type Description
layoutSlotSize Size

The size of the part of the element that does visual presentation.

Returns

Geometry:

The clipping geometry.

OnCustomDraw(DrawingContext)

Raises the CustomDraw event.

protected virtual void OnCustomDraw(DrawingContext drawingContext)
Parameter Type Description
drawingContext DrawingContext

The DrawingContext to use.

OnRender(DrawingContext)

When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.

protected override void OnRender(DrawingContext drawingContext)
Parameter Type Description
drawingContext DrawingContext

The drawing instructions for a specific element. This context is provided to the layout system.

Events

CustomDraw

Occurs when the element requests to be custom drawn.

public event EventHandler<CustomDrawElementCustomDrawEventArgs> CustomDraw

Event Type

EventHandler<CustomDrawElementCustomDrawEventArgs>

Fields

CustomDrawEvent

Defines the CustomDraw event.

public static readonly RoutedEvent CustomDrawEvent

Extension Methods