FocusPrimitive
Represents a primitive element that renders focus indicators for UI controls.
FocusPrimitive draws rectangular outlines that can be used to indicate keyboard focus.
The appearance is configured through its box style, gradient style, angle, and outer and inner colors. The primitive does not draw dotted or dashed outlines.
The primitive paints nested rectangular outlines. Outside the four-border box style, it uses separate outer and inner color sets and renders solid or linear gradients; other gradient styles are not handled. The supplied parent border affects the outer outline's inset.
FocusPrimitive is essential for accessibility compliance and keyboard navigation support, ensuring that users can clearly identify which control currently has input focus.
Definition
Namespace:Telerik.WinControls.Primitives
Assembly:Telerik.WinControls.dll
Syntax:
public class FocusPrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementBasePrimitiveFocusPrimitive...
Implements:
Inherited Members
Constructors
Creates a focus indicator whose outer outline accounts for the supplied border's box style.
public FocusPrimitive(BorderPrimitive border)
The border primitive whose box style determines the focus outline inset.
Fields
Identifies the property that controls the focus outlines' box style.
public static readonly RadProperty BorderBoxStyleProperty
Identifies the second outer-outline color used by linear gradients.
public static RadProperty ForeColor2Property
Identifies the third outer-outline color used by linear gradients.
public static RadProperty ForeColor3Property
Identifies the fourth outer-outline color used by linear gradients.
public static RadProperty ForeColor4Property
Identifies the angle, in degrees, used by linear focus-outline gradients.
public static RadProperty GradientAngleProperty
Identifies the gradient style used to render each focus outline.
public static RadProperty GradientStyleProperty
Identifies the second inner-outline color used by linear gradients.
public static RadProperty InnerColor2Property
Identifies the third inner-outline color used by linear gradients.
public static RadProperty InnerColor3Property
Identifies the fourth inner-outline color used by linear gradients.
public static RadProperty InnerColor4Property
Identifies the first inner-outline color used by linear gradients.
public static RadProperty InnerColorProperty
Properties
Gets or sets the border box style for the focus indicator.
public BorderBoxStyle BoxStyle { get; set; }
A BorderBoxStyle value that determines how the focus border is rendered.
The box style affects how the focus border appears, including whether it's a single border, four separate borders, or outer and inner borders for enhanced visibility.
Gets or sets how the focus indicator is sized relative to its parent; initialization uses FitToParentBounds.
public override RadFitToSizeMode FitToSizeMode { get; set; }
Overrides:
Gets or sets the second color in the outer outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color ForeColor2 { get; set; }
Gets or sets the third color in the outer outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color ForeColor3 { get; set; }
Gets or sets the fourth color in the outer outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color ForeColor4 { get; set; }
Gets or sets gradient angle for linear gradient measured in degrees.
public float GradientAngle { get; set; }
Gets or sets the style used to render each focus outline. Outside the four-border box style, only solid and linear are rendered.
public GradientStyles GradientStyle { get; set; }
The four-border box style uses
ForeColorregardless of this setting.
Gets or sets the solid color and first stop of the inner outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color InnerColor { get; set; }
Gets or sets the second color in the inner outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color InnerColor2 { get; set; }
Gets or sets the third color in the inner outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color InnerColor3 { get; set; }
Gets or sets the fourth color in the inner outline's linear gradient.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color InnerColor4 { get; set; }
Methods
Initializes the primitive to size itself automatically within its parent's bounds.
protected override void InitializeFields()
Overrides:
Paints nested rectangular focus outlines using the configured outer and inner colors.
public override void PaintPrimitive(IGraphics graphics, float angle, SizeF scale)
The drawing surface.
anglefloatThe paint angle supplied by the base pipeline; this implementation does not use it.
scaleSizeFThe paint scale supplied by the base pipeline; this implementation does not use it.
Overrides:
The four-border box style uses
ForeColorfor both outlines. Other box styles render only solid and linear gradients.