ClassRadCalculatorElement
Represents a calculator element that provides standard calculator functionality including arithmetic operations, memory functions, and display capabilities.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadCalculatorElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, ICalculatorElement, ICalculatorButtonElementContainer
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadCalculatorElement
Implements:
Inherited Members
Constructors
RadCalculatorElement()
Initializes a new instance of the RadCalculatorElement class.
Declaration
public RadCalculatorElement()
Properties
CalculationBehavior
Gets or sets the calculation behavior.
Declaration
public StandardCalculatorCalculationBehavior CalculationBehavior { get; set; }
Property Value
ContentElement
Gets the RadCalculatorContentElement, which is responsible for calculator buttons and their layout.
Declaration
public RadCalculatorContentElement ContentElement { get; }
Property Value
Culture
Gets or sets current culture for the RadCalculatorElement.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Implements
TextAreaElement
Gets the RadCalculatorTextAreaElement, which is responsible for the displayed value, memory and history.
Declaration
public RadCalculatorTextAreaElement TextAreaElement { get; }
Property Value
Methods
ArrangeOverride(SizeF)
Arranges the RadElement to its final location. The element must call the Arrange method of each of its children.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
finalSize
The size that is available for element.
Returns
The rectangle occupied by the element. Usually finalSize. Should you return different size, the Layout system will restart measuring and rearranging the items. That could lead to infinite recursion.
Overrides
Remarks
In this method call to the Arrange method of each child must be made.
CreateCalculationBehavior()
Creates the calculation behavior responsible for the mathematic operations and history.
Declaration
protected virtual StandardCalculatorCalculationBehavior CreateCalculationBehavior()
Returns
StandardCalculatorCalculationBehavior
A new instance of StandardCalculatorCalculationBehavior.
CreateChildElements()
Called by the element when constructed. Allows inheritors to build the element tree.
Declaration
protected override void CreateChildElements()
Overrides
CreateContentElement()
Creates the RadCalculatorContentElement, which is responsible for calculator buttons and their layout.
Declaration
protected virtual RadCalculatorContentElement CreateContentElement()
Returns
A new instance of RadCalculatorContentElement.
CreateTextPartElement()
Creates the RadCalculatorTextAreaElement, which is responsible for the displayed value, memory and history.
Declaration
protected virtual RadCalculatorTextAreaElement CreateTextPartElement()
Returns
A new instance of RadCalculatorTextAreaElement.
GetFormattedValue()
Gets the formatted display value for the calculator.
Declaration
protected virtual string GetFormattedValue()
Returns
A formatted string representation of the current value or "0" if no value is present.
InitializeFields()
Initializes member fields to their default values. This method is called prior the CreateChildItems one and allows for initialization of members on which child elements depend.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the space required by the RadElement
Used by the layout system.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
availableSize
The size that is available to the RadElement. The available size can be infinity (to take the full size of the element)
Returns
The minimum size required by the element to be completely visible. Cannot be infinity.
Overrides
Remarks
In this method call to the Measure method of each child must be made.
OnButtonMouseUp(RadCalculatorButton, MouseEventArgs)
Executed when a calculator button mouse up event is fired.
Declaration
public void OnButtonMouseUp(RadCalculatorButton button, MouseEventArgs e)
Parameters
button
The RadCalculatorButton that was clicked.
e
The MouseEventArgs containing event data.
Implements
OnCalculatorKeyDown(KeyEventArgs)
Executed when a key down event is fired in the calculator.
Declaration
public void OnCalculatorKeyDown(KeyEventArgs e)
Parameters
e
The KeyEventArgs containing event data.
Implements
OnCalculatorKeyPress(KeyPressEventArgs)
Executed when a key press event is fired in the calculator.
Declaration
public void OnCalculatorKeyPress(KeyPressEventArgs e)
Parameters
e
The KeyPressEventArgs containing event data.
Implements
OnDisplayValueChanged()
Executed when the display value needs to be updated.
Declaration
public void OnDisplayValueChanged()
Implements
OnDisplayValueChanging(string, string)
Executed when the displayed value is about to be updated. Cancellable.
OnHistoryUpdated(string)
Executed when the calculator history text needs to be updated.
Declaration
public void OnHistoryUpdated(string lastAction)
Parameters
lastAction
The text representing the last performed action.
Implements
OnMemoryUpdated(bool)
Executed when the calculator memory is updated.
Declaration
public void OnMemoryUpdated(bool hasMemory)
Parameters
hasMemory
A value indicating whether the calculator has a value stored in memory.
Implements
OnValueChanged()
Fires the ValueChanged event.
Declaration
protected virtual void OnValueChanged()
OnValueChanging(ValueChangingEventArgs)
Fires the ValueChanging event.
Declaration
protected virtual void OnValueChanging(ValueChangingEventArgs args)
Parameters
args
The ValueChangingEventArgs containing event data.
ShouldArrangeChild(RadElement)
Gets a value indicating, whether a child will be arranged during the ArrangeOverride.
Declaration
protected override bool ShouldArrangeChild(RadElement child)
Parameters
child
The child.
Returns
Whether the child will be arranged in ArrangeOverride.
Overrides
ShouldMeasureChild(RadElement)
Gets a value indicating, whether a child will be measured during the MeasureOverride.
Declaration
protected override bool ShouldMeasureChild(RadElement child)
Parameters
child
The child.
Returns
Whether the child will be measured in MeasureOverride.
Overrides
UpdateText()
Updates the displayed text/value.
Declaration
protected virtual void UpdateText()
Events
ValueChanged
Fired when the displayed value has changed.
ValueChanging
Fired when the display value is about to be changed.
Declaration
public event ValueChangingEventHandler ValueChanging
Event Value