ClassGroupStatePrimitive
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.
Definition
Namespace:Telerik.WinControls.Primitives
Assembly:Telerik.WinControls.dll
Syntax:
public class GroupStatePrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementBasePrimitiveGroupStatePrimitive
Implements:
Inherited Members
Constructors
GroupStatePrimitive()
Declaration
public GroupStatePrimitive()
Fields
GroupStateProperty
Identifies the State dependency property.
Declaration
public static readonly RadProperty GroupStateProperty
Field Value
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
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
public PanelBarStyles PanelBarStyle { get; set; }
Property Value
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
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
false by default. Group state indicators typically maintain fixed width for consistent appearance.
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
false by default. Group state indicators typically maintain fixed height for consistent appearance.
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
availableSize
The available size that this primitive can be given.
Returns
The 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, float, 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
graphics
The IGraphics interface used for drawing the state indicator.
angle
The rotation angle in degrees to apply to the rendered content.
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.