Class GroupStatePrimitive
Represents a primitive element that renders visual indicators for expandable/collapsible group states, commonly used in panel bars, tree views, and other hierarchical controls within the Telerik WinControls framework.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.Primitives
Assembly: Telerik.WinControls.dll
Syntax
public class GroupStatePrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Remarks
The GroupStatePrimitive class provides specialized rendering capabilities for displaying expand/collapse indicators with support for multiple visual styles including Visual Studio 2005 ToolBox and Explorer Bar styles. The primitive automatically adapts its visual representation based on the current state (expanded or collapsed) and the selected panel bar style.
This primitive is typically used as part of larger composite elements in panel bars, accordion controls, and tree view implementations where users need visual feedback about the current state of expandable sections. The primitive supports anti-aliased rendering for smooth visual appearance and provides configurable styling options through the PanelBarStyle property.
Key features include state-based rendering (expanded/collapsed), multiple visual styles (ToolBox/Explorer), anti-aliased graphics for smooth appearance, and integration with the RadProperty system for consistent theming and styling across the framework.
Constructors
GroupStatePrimitive()
Declaration
public GroupStatePrimitive()
Fields
GroupStateProperty
Identifies the State dependency property.
Declaration
public static readonly RadProperty GroupStateProperty
Field Value
RadProperty
|
Remarks
This property controls whether the group is currently expanded or collapsed, which directly affects the visual representation of the state indicator.
GroupStyleProperty
Identifies the PanelBarStyle dependency property.
Declaration
public static readonly RadProperty GroupStyleProperty
Field Value
RadProperty
|
Remarks
This property determines the visual style used for rendering the group state indicator, affecting how the expand/collapse visual cues are displayed to the user.
Properties
PanelBarStyle
Gets or sets the visual style for the panel bar group state indicator.
Declaration
[RadPropertyDefaultValue("PanelBarStyle", typeof(GroupStatePrimitive))]
public PanelBarStyles PanelBarStyle { get; set; }
Property Value
PanelBarStyles
A PanelBarStyles enumeration value that determines the visual appearance of the group state indicator. The default value is ExplorerBarStyle. |
Remarks
This property controls how the expand/collapse indicator is visually represented:
- VisualStudio2005ToolBox: Renders simple line-based indicators similar to Visual Studio's toolbox
- ExplorerBarStyle: Renders filled arrow-shaped indicators with double arrows for enhanced visibility
Changing this property triggers a repaint of the primitive to reflect the new visual style. The style affects both the expanded and collapsed state representations.
State
Gets or sets the current state of the group (expanded or collapsed).
Declaration
[RadPropertyDefaultValue("State", typeof(GroupStatePrimitive))]
public GroupStatePrimitive.GroupState State { get; set; }
Property Value
GroupStatePrimitive.GroupState
A GroupStatePrimitive.GroupState enumeration value indicating whether the group is expanded or collapsed. The default value is Expanded. |
Remarks
This property determines the visual representation of the group state indicator:
- Expanded: Shows collapse indicators (minus signs, down arrows, etc.)
- Collapsed: Shows expand indicators (plus signs, right arrows, etc.)
The exact visual representation depends on the current PanelBarStyle setting. Changing this property triggers an immediate repaint to show the updated state.
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
Group state primitives are generally designed to have a fixed size to ensure consistent visual appearance
across different container sizes. Setting this to true
may cause the indicator 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
Group state primitives are generally designed to have a fixed size to ensure consistent visual appearance
across different container sizes. Setting this to true
may cause the indicator to appear distorted.
Methods
InitializeFields()
Initializes the default field values for the group state primitive.
Declaration
protected override void InitializeFields()
Overrides
Remarks
This method sets up the primitive to have fixed sizing by default, as group state indicators typically have a predetermined size and should not stretch to fill available space. The primitive is configured to maintain its intrinsic dimensions for consistent appearance.
MeasureOverride(SizeF)
Measures the desired size of the group state primitive within the specified available size.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size that this primitive can be given. |
Returns
System.Drawing.SizeF
The System.Drawing.SizeF representing the desired size of the primitive. Returns a minimum size of 10x10 pixels to ensure the indicator remains visible and interactive. |
Overrides
Remarks
This method ensures that all child elements have their Measure method called during the layout process, then returns a consistent minimum size for the group state indicator. The fixed minimum size ensures that the indicator remains visible and clickable regardless of the available space.
The 10x10 pixel minimum size provides sufficient area for rendering both simple line-based indicators (Visual Studio ToolBox style) and more complex polygon-based indicators (Explorer Bar style) while maintaining good usability for mouse and touch interactions.
PaintPrimitive(IGraphics, Single, SizeF)
Renders the group state 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 state indicator. |
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 different visual indicators based on the current PanelBarStyle and State values:
Visual Studio 2005 ToolBox Style:
- Expanded: Renders a horizontal line across the center
- Collapsed: Renders both horizontal and vertical lines forming a plus sign
Explorer Bar Style:
- Expanded: Renders double up-pointing arrow polygons with shadow effect
- Collapsed: Renders double down-pointing arrow polygons with shadow effect
The method uses anti-aliased rendering for smooth visual appearance and applies the primitive's ForeColor for the main indicator elements.