Table of Contents

Class GlyphAdorner

Namespace
Tudormobile.Wpf.Adorners
Assembly
Tudormobile.WpfControls.dll

Provides a custom adorner that displays a glyph (icon or symbol) alongside a control, such as a TextBoxBase. The Glyphs must be frmom the "Segoe Fluent Icons" font. The adorner adjusts the padding of the adorned control to accommodate the glyph, ensuring it does not overlap with the control's content.

public class GlyphAdorner : Adorner, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient
Inheritance
GlyphAdorner
Implements
Derived
Inherited Members

Remarks

The GlyphAdorner is designed to adorn a control with a glyph, typically for decorative or functional purposes. The glyph is rendered using the "Segoe Fluent Icons" font and is positioned relative to the adorned element's padding. This adorner is not hit-test visible and does not interfere with user interactions on the adorned control.

Currently , the adorner is primarily intended for use with TextBoxBase controls, however it may be extended in the future to support other control types as needed.

Constructors

GlyphAdorner(UIElement)

Initializes a new instance of the GlyphAdorner class, which provides a visual adornment for the specified control.

public GlyphAdorner(UIElement adornedElement)

Parameters

adornedElement UIElement

The Control to which the adornment is applied. This adorned UIElement cannot be null.

Remarks

The GlyphAdorner is a non-interactive visual element, as indicated by its IsHitTestVisible property being set to false.

Properties

FontSize

Font size for the glyph

public double FontSize { get; set; }

Property Value

double

Glyph

Gets or sets the glyph associated with this instance. The Glyph is a string representing a character from the "Segoe Fluent Icons" font.

public string? Glyph { get; set; }

Property Value

string

GlyphSize

Gets the size of the glyph represented by the adorned element.

public Size GlyphSize { get; }

Property Value

Size

Remarks

The size is calculated based on the glyph's text, font size, and other visual properties of the adorned element. If the adorned element is a Control, its font size and foreground brush are used in the calculation; otherwise 12pt font with Black text is used.

Padding

Original padding value

public Thickness Padding { get; set; }

Property Value

Thickness

Methods

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)

Parameters

drawingContext DrawingContext

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

OnRenderSizeChanged(SizeChangedInfo)

Raises the SizeChanged event, using the specified information as part of the eventual event data.

protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)

Parameters

sizeInfo SizeChangedInfo

Details of the old and new size involved in the change.