HypernovaDesktop Components · docs
Binarymission
WPF › Circular Panel › CircularPanel

CircularPanel

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Panels

A custom panel control class that provides a circular layout for its children items.

public class CircularPanel : Panel

Inherits from / implements: Panel

Members at a glance

CircularPanelInitializes a new instance of the CircularPanel class.
AngleCalculationStrategyGets or sets the angle calculation strategy.
ItemsClosenessFactorGets or sets how far in from the panel's edge the ring of items sits.
ItemsGapAngleFactorGets or sets the items gap angle factor.
RenderAngleGets or sets the render angle.
ArrangeOverrideWhen overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.
MeasureOverrideWhen overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.
AngleCalculationStrategyPropertyThe angle calculation strategy property
ItemsClosenessFactorPropertyThe items closeness factor property
ItemsGapAngleFactorPropertyThe items gap angle factor property
RenderAnglePropertyThe render angle property

Constructors

CircularPanel

public CircularPanel() : base()

Initializes a new instance of the CircularPanel class.

Properties

AngleCalculationStrategy

public GapAngleCalculationStrategy AngleCalculationStrategy

Gets or sets the angle calculation strategy.

Value. The angle calculation strategy.

ItemsClosenessFactor

public double ItemsClosenessFactor

Gets or sets how far in from the panel's edge the ring of items sits.

Value. The factor the panel's size is divided by to get the ring's radii. Larger is a tighter ring; the default is 2.5.

The radii are the panel's width and height divided by this, so what is left between the ring and the panel's edge is clearance = size * (0.5 - 1 / factor) - item / 2 which is the one line worth keeping. Below 2 the bracket is negative: the radius is more than half the panel and the items' centres fall outside it altogether. Above 2 the clearance grows with the factor, but it is a fraction of the panel's size, not a fixed margin - the default of 2.5 leaves 0.1 * size , which is four units for an 88 unit item in a 480 unit panel and less than nothing in anything smaller. A panel that has to hold a given item needs size >= item / (2 * (0.5 - 1 / factor)) . None of it is prevented: a panel does not clip its children, so the items are still drawn, and a ring deliberately larger than its panel is a reasonable thing to ask for inside something that clips. But a value below 2 in a clipping container shows nothing at all, which looks like a control that has stopped working.

ItemsGapAngleFactor

public double ItemsGapAngleFactor

Gets or sets the items gap angle factor.

Value. The items gap angle factor.

RenderAngle

public double RenderAngle

Gets or sets the render angle.

Value. The render angle.

Methods

ArrangeOverride

protected override Size ArrangeOverride(Size finalSize)

When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.

finalSize
The final area within the parent that this element should use to arrange itself and its children.

Returns. The actual size used.

MeasureOverride

protected override Size MeasureOverride(Size availableSize)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.

availableSize
The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns. The size that this element determines it needs during layout, based on its calculations of child element sizes.

Fields

AngleCalculationStrategyProperty

public static readonly DependencyProperty AngleCalculationStrategyProperty = DependencyProperty.Register( "AngleCalculationStrategy", typeof(GapAngleCalculationStrategy), typeof(CircularPanel), new PropertyMetadata(GapAngleCalculationStrategy.Dynamic, (o, args)

The angle calculation strategy property

ItemsClosenessFactorProperty

public static readonly DependencyProperty ItemsClosenessFactorProperty = DependencyProperty.Register( "ItemsClosenessFactor", typeof(double), typeof(CircularPanel), new PropertyMetadata(2.5d, (o, args)

The items closeness factor property

ItemsGapAngleFactorProperty

public static readonly DependencyProperty ItemsGapAngleFactorProperty = DependencyProperty.Register( "ItemsGapAngleFactor", typeof(double), typeof(CircularPanel), new PropertyMetadata(DefaultAngleFactor, (o, args)

The items gap angle factor property

RenderAngleProperty

public static readonly DependencyProperty RenderAngleProperty = DependencyProperty.Register( "RenderAngle", typeof(double), typeof(CircularPanel), new PropertyMetadata(default(double), (o, args)

The render angle property