Class CircularScale
Represents the scale visual element.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Gauge
Assembly: Syncfusion.Gauge.WPF.dll
Syntax
public class CircularScale : ScaleBase, IDisposable
Remarks
The CircularScale is the System.Windows.Media.Visual.VisualParent for the various elements of the Gauge, such as CircularLabelTick, CircularMarkTick, CircularRange, and CircularPointer.
Examples
using System;
using System.Windows;
using System.Windows.Controls;
using Syncfusion.Windows.Shared;
using Syncfusion.Windows.Gauge;
namespace CircularScaleSample
{
public partial class Window1 : Window
{
private CircularScale m_scale;
private CircularGauge m_gauge;
public Window1()
{
InitializeComponent();
m_scale = new CircularScale();
m_gauge = new CircularGauge();
m_scale.ShadowOffset = 1;
m_scale.Minimum = 0;
m_scale.Maximum = 100;
m_scale.MinorIntervalValue = 2;
m_scale.MajorIntervalValue = 10;
m_scale.StartAngle = 120;
m_scale.GapSweepAngle = 300;
m_scale.ScaleBarSize = 5;
m_scale.Radius = 116;
this.m_gauge.Scales.Add(m_scale);
this.Content = m_gauge;
}
}
}
Constructors
CircularScale()
Initializes a new instance of the CircularScale class.
Declaration
public CircularScale()
Remarks
Initializes all its Child Collections and registers its method CollectionChanged to its Children's CollectionChanged event.
Fields
EnableCustomScaleAngleProperty
Identifies the GapSweepAngle dependency property.
Declaration
public static readonly DependencyProperty EnableCustomScaleAngleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
GapSweepAngleProperty
Identifies the GapSweepAngle dependency property.
Declaration
public static readonly DependencyProperty GapSweepAngleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IsLogarithmicProperty
Declaration
public static readonly DependencyProperty IsLogarithmicProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LogBaseProperty
Declaration
public static readonly DependencyProperty LogBaseProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
PointerCapProperty
Identifies the PointerCap dependency property.
Declaration
public static readonly DependencyProperty PointerCapProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
RadiusProperty
Identifies the Radius dependency property.
Declaration
public static readonly DependencyProperty RadiusProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
StartAngleProperty
Identifies the StartAngle dependency property.
Declaration
public static readonly DependencyProperty StartAngleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
EnableCustomScaleAngle
Sets or Gets the IsCustomScalingAngle property
Declaration
public bool EnableCustomScaleAngle { get; set; }
Property Value
Type |
---|
System.Boolean |
GapSweepAngle
Gets or sets the number of degrees that the scale will sweep in a circle. This is a dependency property.
Declaration
public double GapSweepAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
IsLogarithmic
Declaration
public bool IsLogarithmic { get; set; }
Property Value
Type |
---|
System.Boolean |
LogBase
Declaration
public double LogBase { get; set; }
Property Value
Type |
---|
System.Double |
PointerCap
Gets or sets the PointerCap of the pointer. This is a dependency property.
Declaration
public PointerCap PointerCap { get; set; }
Property Value
Type | Description |
---|---|
PointerCap | Type: PointerCap |
Pointers
Gets or sets a collection of pointers.
Declaration
public PointersCollection Pointers { get; set; }
Property Value
Type | Description |
---|---|
PointersCollection | Type: PointersCollection |
Radius
Gets or sets the radius of the scale. This is a dependency property.
Declaration
public double Radius { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
StartAngle
Gets or sets the start angle from which the scale should be drawn. This is a dependency property.
Declaration
public double StartAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
VisualChildrenCount
Gets the number of visual child elements within this element.
Declaration
protected override int VisualChildrenCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Type: System.Int32 |
Remarks
Returns number of Children it contains. The addition of 2 is to add PointerCap and PointerCapShadow to the count.
Methods
ArrangeOverride(Size)
Positions child elements and determines a size for the element.
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | finalSize | The final area within the parent that this element should use to arrange itself and its children. |
Returns
Type | Description |
---|---|
System.Windows.Size | The actual size used. |
Remarks
Loops through and gets each and every child element.Arranges Pointer element to the center of the Scale in such a way that the scale's center and the Pointer's height's center coincides. For marker, instead of arranging it at the center of the Scale it arranges it based on its ScalePlacement's Value, so as Tick are arranged. Remaining elements, it arranges them at the center of the scale. Then the Scale's PathFigure is created.
CoerceMinimum(Object)
Declaration
protected override object CoerceMinimum(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type |
---|
System.Object |
Overrides
CoercePointerCap(Object)
Fulfils the logic before setting the value of PointerCap dependency property.
Declaration
protected virtual object CoercePointerCap(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value that should be corrected. |
Returns
Type | Description |
---|---|
System.Object | The corrected value. |
CoercePointerCap(DependencyObject, Object)
Coerces the value of the PointerCap property.
Declaration
public static object CoercePointerCap(DependencyObject d, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | d | The CircularScale object. |
System.Object | value | The instance containing the event data. |
Returns
Type | Description |
---|---|
System.Object | The checked value. |
CoerceRadius(Object)
Fulfils the logic before setting the value of Radius dependency property.
Declaration
protected virtual object CoerceRadius(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value that should be corrected. |
Returns
Type | Description |
---|---|
System.Object | The corrected value. |
CoerceRadius(DependencyObject, Object)
Coerces the value of the Radius property.
Declaration
public static object CoerceRadius(DependencyObject d, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | d | The CircularScale object. |
System.Object | value | The instance containing the event data. |
Returns
Type | Description |
---|---|
System.Object | The checked value. |
Dispose()
Declaration
public void Dispose()
GetVisualChild(Int32)
Returns a child at the specified index from a collection of child elements.
Declaration
protected override Visual GetVisualChild(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | he zero-based index of the requested child element in the collection. |
Returns
Type | Description |
---|---|
System.Windows.Media.Visual | The requested child element. |
Remarks
Since PointerCapShadow is added as a Child element in the Constructor itself, index 0 represents it.Then comes the Ranges collection, then the Ticks and the last one in Pointers Collection. Pointers are added at the last because the latter the elements are added they will be on top of others.
MeasureOverride(Size)
Measures the size in layout required for child elements and determines a size for the element.
Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | availableSize | The available size that this element can give to child elements. |
Returns
Type | Description |
---|---|
System.Windows.Size | The size that this element determines it needs during layout. |
Remarks
The diameter of the CircularGauge is written as the required width and height.
OnGapSweepAngleChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises GapSweepAngleChanged event.
Declaration
protected virtual void OnGapSweepAngleChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnInitialized(EventArgs)
Raises the System.Windows.FrameworkElement.Initialized event. This method is invoked whenever System.Windows.FrameworkElement.IsInitialized property is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs that contains the event data. |
OnIsCustomScalingAngleChanged(DependencyPropertyChangedEventArgs)
This method is called when Custom Scale Angle is changed
Declaration
protected virtual void OnIsCustomScalingAngleChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | An System.Windows.DependencyPropertyChangedEventArgs that contains the event data. |
OnMaximumChanged(DependencyPropertyChangedEventArgs)
Invoked when Maximum property is changed.
Declaration
protected override void OnMaximumChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
Overrides
OnMinimumChanged(DependencyPropertyChangedEventArgs)
Invoked when Minimum property is changed.
Declaration
protected override void OnMinimumChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
Overrides
OnPointerCapChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises PointerCapChanged event.
Declaration
protected virtual void OnPointerCapChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnRadiusChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises RadiusChanged event.
Declaration
protected virtual void OnRadiusChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnRender(DrawingContext)
Participates in rendering operations that are directed by the layout system.
Declaration
protected override void OnRender(DrawingContext drawingContext)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | drawingContext | The drawing instructions for a specific element. |
OnScaleDirectionChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises ScaleBarSizeChanged event.
Declaration
protected override void OnScaleDirectionChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
Overrides
OnStartAngleChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises StartAngleChanged event.
Declaration
protected virtual void OnStartAngleChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
RefreshCircularScale()
Refreshes the Circular Scale by invalidating the Visual of all its child elements.
Declaration
public void RefreshCircularScale()
Events
GapSweepAngleChanged
Event that is raised when GapSweepAngle property is changed.
Declaration
public event PropertyChangedCallback GapSweepAngleChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
PointerCapChanged
Event that is raised when PointerCap property is changed.
Declaration
public event PropertyChangedCallback PointerCapChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
RadiusChanged
Event that is raised when Radius property is changed.
Declaration
public event PropertyChangedCallback RadiusChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
StartAngleChanged
Event that is raised when StartAngle property is changed.
Declaration
public event PropertyChangedCallback StartAngleChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |