OverflowPrimitive
Represents a primitive element that renders directional overflow indicators, typically used to show that content extends beyond the visible area and can be scrolled or expanded in a specific direction.
Definition
Namespace:Telerik.WinControls.Primitives
Assembly:Telerik.WinControls.dll
Syntax:
public class OverflowPrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementBasePrimitiveOverflowPrimitive...
Implements:
Inherited Members
Constructors
Initializes a new instance of the OverflowPrimitive class with the specified arrow direction.
public OverflowPrimitive(ArrowDirection arrowDirection)
The direction of the overflow arrow indicator.
This constructor sets up the overflow primitive with the specified direction and automatically determines the appropriate minimum size based on the arrow orientation:
- Left/Right arrows use MinHorizontalSize (4x8 pixels)
- Up/Down arrows use MinVerticalSize (8x10 pixels)
The constructor ensures that the primitive has an appropriate size for the specified direction, providing adequate space for rendering the arrow indicator while maintaining good usability.
Fields
Identifies the Direction dependency property.
public static readonly RadProperty ArrowDirectionProperty
This property determines the direction of the overflow arrow indicator, affecting both the visual appearance and the automatic sizing behavior of the primitive.
Identifies the DrawArrow dependency property.
public static readonly RadProperty DrawArrowProperty
This property provides control over whether the arrow indicator is actually rendered, allowing the primitive to be temporarily hidden while maintaining its layout space.
Defines the minimum size for horizontal overflow arrows (Left and Right directions).
public static readonly Size MinHorizontalSize
This size ensures adequate space for rendering horizontal arrow indicators while maintaining good usability for mouse and touch interactions. The 4x8 pixel size provides sufficient visual presence without consuming excessive layout space.
Defines the minimum size for vertical overflow arrows (Up and Down directions).
public static readonly Size MinVerticalSize
This size ensures adequate space for rendering vertical arrow indicators while maintaining good usability for mouse and touch interactions. The 8x10 pixel size provides sufficient visual presence without consuming excessive layout space.
Identifies the ShadowColor dependency property.
public static readonly RadProperty ShadowColorProperty
This property controls the color used for shadow effects in the overflow arrow, enhancing the visual depth and making the indicator more prominent against various backgrounds.
Properties
Gets or sets the direction of the overflow arrow indicator.
public ArrowDirection Direction { get; set; }
An ArrowDirection enumeration value specifying the direction of the overflow indicator. The default value is Down.
This property determines both the visual appearance of the arrow and the automatic sizing behavior:
- Left: Points left, uses horizontal sizing
- Right: Points right, uses horizontal sizing
- Up: Points up, uses vertical sizing
- Down: Points down, uses vertical sizing
Changing this property automatically adjusts the primitive's size to match the appropriate minimum dimensions for the new direction and triggers a layout invalidation.
Gets or sets a value indicating whether the overflow arrow should be rendered.
public bool DrawArrow { get; set; }
true to render the arrow indicator; false to hide it. The default value is true.
This property allows the overflow indicator to be temporarily hidden while maintaining its
layout space and other properties. When set to false, the PaintPrimitive(IGraphics, float, SizeF)
method returns immediately without rendering any visual content.
This is useful in scenarios where overflow indicators need to be conditionally shown based on content state, available space, or user preferences without requiring layout changes.
Gets or sets the color used for shadow effects in the overflow arrow.
public Color ShadowColor { get; set; }
A Color value representing the shadow color. The default value is White.
This color is used to render shadow elements that enhance the visual depth of the overflow arrow, making it more prominent and easier to see against various background colors. The shadow effect helps distinguish the arrow from the surrounding content.
For best visual results, this color should provide appropriate contrast with both the main arrow color (ForeColor) and the containing element's background.
Gets or sets a value indicating whether the primitive should stretch horizontally to fill available space.
public override bool StretchHorizontally { get; set; }
false by default. Overflow indicators typically maintain fixed width for consistent appearance.
Overrides:
Overflow arrows are generally designed to have a fixed size to ensure consistent visual appearance
and proper user interaction. Setting this to true may cause the arrow to appear distorted.
Gets or sets a value indicating whether the primitive should stretch vertically to fill available space.
public override bool StretchVertically { get; set; }
false by default. Overflow indicators typically maintain fixed height for consistent appearance.
Overrides:
Overflow arrows are generally designed to have a fixed size to ensure consistent visual appearance
and proper user interaction. Setting this to true may cause the arrow to appear distorted.
Methods
Initializes the default field values for the overflow primitive.
protected override void InitializeFields()
Overrides:
This method configures the primitive to have fixed sizing by default, as overflow indicators typically have predetermined dimensions and should not stretch to fill available space. The primitive maintains its intrinsic size for consistent visual appearance.
Handles property changes for the overflow primitive, specifically responding to direction changes.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
A RadPropertyChangedEventArgs that contains the event data.
Overrides:
This method responds to changes in the ArrowDirection property by automatically adjusting the primitive's size to match the appropriate minimum dimensions for the new direction:
- Left/Right directions: Sets size to MinHorizontalSize (4x8 pixels)
- Up/Down directions: Sets size to MinVerticalSize (8x10 pixels)
The sizing behavior respects the AutoSize property:
- When AutoSize is enabled: Updates the MinSize property
- When AutoSize is disabled: Updates the Size property directly
This automatic sizing ensures that the arrow indicator always has adequate space for proper rendering and user interaction regardless of the direction change.
Renders the overflow arrow indicator using the specified graphics context, applying rotation and scaling transformations.
public override void PaintPrimitive(IGraphics graphics, float angle, SizeF scale)
The IGraphics interface used for drawing the overflow arrow.
anglefloatThe rotation angle in degrees to apply to the rendered content.
scaleSizeFThe scaling factor to apply to the rendered content.
Overrides:
This method renders directional arrow indicators with anti-aliased graphics for smooth appearance. Each direction has its own specialized rendering implementation:
Left Arrow: Renders a left-pointing triangle with background accent lines
Right Arrow: Renders a right-pointing triangle with foreground accent line
Up Arrow: Renders an up-pointing triangle with background accent lines
Down Arrow: Renders a down-pointing double-triangle with shadow effect using both ShadowColor and ForeColor
The method respects the DrawArrow property and returns immediately without rendering if the arrow is disabled. Anti-aliasing is enabled for smooth triangle edges and restored after rendering.