Class 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.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.Primitives
Assembly: Telerik.WinControls.dll
Syntax
public class OverflowPrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Remarks
The OverflowPrimitive class provides specialized rendering capabilities for displaying directional arrow indicators that inform users about hidden or overflow content. These indicators are commonly used in toolbars, menus, tab strips, and other container controls where not all content may be visible due to space constraints.
The primitive supports four directional orientations (Up, Down, Left, Right) and renders styled arrow indicators with shadow effects for enhanced visual depth. Each direction has its own specialized rendering implementation that creates appropriate visual cues for the direction of overflow content.
Key features include directional arrow rendering with anti-aliasing, configurable shadow colors for depth effects, optional arrow drawing control, automatic sizing based on direction, and integration with the RadProperty system for consistent theming across the framework.
Constructors
OverflowPrimitive(ArrowDirection)
Initializes a new instance of the OverflowPrimitive class with the specified arrow direction.
Declaration
public OverflowPrimitive(ArrowDirection arrowDirection)
Parameters
ArrowDirection
arrowDirection
The direction of the overflow arrow indicator. |
Remarks
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
ArrowDirectionProperty
Identifies the Direction dependency property.
Declaration
public static readonly RadProperty ArrowDirectionProperty
Field Value
RadProperty
|
Remarks
This property determines the direction of the overflow arrow indicator, affecting both the visual appearance and the automatic sizing behavior of the primitive.
DrawArrowProperty
Identifies the DrawArrow dependency property.
Declaration
public static readonly RadProperty DrawArrowProperty
Field Value
RadProperty
|
Remarks
This property provides control over whether the arrow indicator is actually rendered, allowing the primitive to be temporarily hidden while maintaining its layout space.
MinHorizontalSize
Defines the minimum size for horizontal overflow arrows (Left and Right directions).
Declaration
public static readonly Size MinHorizontalSize
Field Value
System.Drawing.Size
|
Remarks
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.
MinVerticalSize
Defines the minimum size for vertical overflow arrows (Up and Down directions).
Declaration
public static readonly Size MinVerticalSize
Field Value
System.Drawing.Size
|
Remarks
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.
ShadowColorProperty
Identifies the ShadowColor dependency property.
Declaration
public static readonly RadProperty ShadowColorProperty
Field Value
RadProperty
|
Remarks
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
Direction
Gets or sets the direction of the overflow arrow indicator.
Declaration
[RadPropertyDefaultValue("ArrowDirection", typeof(OverflowPrimitive))]
public ArrowDirection Direction { get; set; }
Property Value
ArrowDirection
An ArrowDirection enumeration value specifying the direction of the overflow indicator. The default value is Down. |
Remarks
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.
DrawArrow
Gets or sets a value indicating whether the overflow arrow should be rendered.
Declaration
[RadPropertyDefaultValue("DrawArrow", typeof(OverflowPrimitive))]
public bool DrawArrow { get; set; }
Property Value
System.Boolean
|
Remarks
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, Single, 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.
ShadowColor
Gets or sets the color used for shadow effects in the overflow arrow.
Declaration
[RadPropertyDefaultValue("ShadowColor", typeof(OverflowPrimitive))]
public Color ShadowColor { get; set; }
Property Value
System.Drawing.Color
A System.Drawing.Color value representing the shadow color. The default value is System.Drawing.Color.White. |
Remarks
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.
StretchHorizontally
Gets or sets a value indicating whether the primitive should stretch horizontally to fill available space.
Declaration
public override bool StretchHorizontally { get; set; }
Property Value
System.Boolean
|
Overrides
Remarks
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.
StretchVertically
Gets or sets a value indicating whether the primitive should stretch vertically to fill available space.
Declaration
public override bool StretchVertically { get; set; }
Property Value
System.Boolean
|
Overrides
Remarks
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
InitializeFields()
Initializes the default field values for the overflow primitive.
Declaration
protected override void InitializeFields()
Overrides
Remarks
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.
OnPropertyChanged(RadPropertyChangedEventArgs)
Handles property changes for the overflow primitive, specifically responding to direction changes.
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
RadPropertyChangedEventArgs
e
A RadPropertyChangedEventArgs that contains the event data. |
Overrides
Remarks
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.
PaintPrimitive(IGraphics, Single, SizeF)
Renders the overflow arrow indicator using the specified graphics context, applying rotation and scaling transformations.
Declaration
public override void PaintPrimitive(IGraphics graphics, float angle, SizeF scale)
Parameters
IGraphics
graphics
The IGraphics interface used for drawing the overflow arrow. |
System.Single
angle
The rotation angle in degrees to apply to the rendered content. |
System.Drawing.SizeF
scale
The scaling factor to apply to the rendered content. |
Overrides
Remarks
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.