[]
        
(Showing Draft Content)

GrapeCity.Wpf.SpreadSheet.CellType.Editors.GcDropDownCalculator

GcDropDownCalculator Class

Represents a GcDropDownCalculator control which could perform calculation operations like addition, subtraction, multiplication, and division.

Inheritance
GcDropDownCalculator
Namespace: GrapeCity.Wpf.SpreadSheet.CellType.Editors
Assembly: GrapeCity.Wpf.SpreadSheet.CellType.dll
Syntax
[StyleTypedProperty(Property = "EditButtonStyle", StyleTargetType = typeof(CalculatorButton))]
[StyleTypedProperty(Property = "ErrorMessageStyle", StyleTargetType = typeof(TextBlock))]
[StyleTypedProperty(Property = "HistoryStyle", StyleTargetType = typeof(TextBlock))]
[StyleTypedProperty(Property = "MathButtonStyle", StyleTargetType = typeof(CalculatorButton))]
[StyleTypedProperty(Property = "MemoryButtonStyle", StyleTargetType = typeof(CalculatorButton))]
[StyleTypedProperty(Property = "MemoryStatusStyle", StyleTargetType = typeof(TextBlock))]
[StyleTypedProperty(Property = "NumericButtonStyle", StyleTargetType = typeof(CalculatorButton))]
[StyleTypedProperty(Property = "OutputStyle", StyleTargetType = typeof(TextBlock))]
[StyleTypedProperty(Property = "ResetButtonStyle", StyleTargetType = typeof(CalculatorButton))]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "HasErrors", GroupName = "CalculationStates")]
[TemplateVisualState(Name = "Empty", GroupName = "CalculationStates")]
public class GcDropDownCalculator : ControlBase, IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, ISupportInitialize
<StyleTypedProperty(Property:="EditButtonStyle", StyleTargetType:=GetType(CalculatorButton))>
<StyleTypedProperty(Property:="ErrorMessageStyle", StyleTargetType:=GetType(TextBlock))>
<StyleTypedProperty(Property:="HistoryStyle", StyleTargetType:=GetType(TextBlock))>
<StyleTypedProperty(Property:="MathButtonStyle", StyleTargetType:=GetType(CalculatorButton))>
<StyleTypedProperty(Property:="MemoryButtonStyle", StyleTargetType:=GetType(CalculatorButton))>
<StyleTypedProperty(Property:="MemoryStatusStyle", StyleTargetType:=GetType(TextBlock))>
<StyleTypedProperty(Property:="NumericButtonStyle", StyleTargetType:=GetType(CalculatorButton))>
<StyleTypedProperty(Property:="OutputStyle", StyleTargetType:=GetType(TextBlock))>
<StyleTypedProperty(Property:="ResetButtonStyle", StyleTargetType:=GetType(CalculatorButton))>
<TemplateVisualState(Name:="Disabled", GroupName:="CommonStates")>
<TemplateVisualState(Name:="Normal", GroupName:="CommonStates")>
<TemplateVisualState(Name:="HasErrors", GroupName:="CalculationStates")>
<TemplateVisualState(Name:="Empty", GroupName:="CalculationStates")>
Public Class GcDropDownCalculator
    Inherits ControlBase
    Implements IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, ISupportInitialize
Remarks

A GcDropDownCalculator control can be used on its own, or as a drop-down part of a GrapeCity.Windows.InputMan.GcNumber control. For more information, see GrapeCity.Windows.InputMan.GcNumber.

The GcDropDownCalculator control provides calculation using either the mouse or keyboard. You could click the button in the control or press keys to perform calculation. The following table summarizes keyboard operations.

Key CombinationCalculator Operation
Esc, Ctrl+Delete GrapeCity.Windows.InputMan.CalculatorOperation.C. Clears the current calculation.
Delete GrapeCity.Windows.InputMan.CalculatorOperation.CE. Clears the displayed number.
Back GrapeCity.Windows.InputMan.CalculatorOperation.Backspace. Deletes the last digit of the displayed number.
D0, NumPad0 GrapeCity.Windows.InputMan.CalculatorOperation.Digit0. Puts this number in the calculator display.
D1, NumPad1 GrapeCity.Windows.InputMan.CalculatorOperation.Digit1. Puts this number in the calculator display.
D2, NumPad2 GrapeCity.Windows.InputMan.CalculatorOperation.Digit2. Puts this number in the calculator display.
D3, NumPad3 GrapeCity.Windows.InputMan.CalculatorOperation.Digit3. Puts this number in the calculator display.
D4, NumPad4 GrapeCity.Windows.InputMan.CalculatorOperation.Digit4. Puts this number in the calculator display.
D5, NumPad5 GrapeCity.Windows.InputMan.CalculatorOperation.Digit5. Puts this number in the calculator display.
D6, NumPad6 GrapeCity.Windows.InputMan.CalculatorOperation.Digit6. Puts this number in the calculator display.
D7, NumPad7 GrapeCity.Windows.InputMan.CalculatorOperation.Digit7. Puts this number in the calculator display.
D8, NumPad8 GrapeCity.Windows.InputMan.CalculatorOperation.Digit8. Puts this number in the calculator display.
D9, NumPad9 GrapeCity.Windows.InputMan.CalculatorOperation.Digit9. Puts this number in the calculator display.
Decimal, OemComma, OemPeriod GrapeCity.Windows.InputMan.CalculatorOperation.DecimalPoint. Inserts a decimal point.
F9 GrapeCity.Windows.InputMan.CalculatorOperation.Sign. Changes the sign of the displayed number.
Add, Shift+OemPlus GrapeCity.Windows.InputMan.CalculatorOperation.Add. Adds.
Subtract, Shift+OemMinus GrapeCity.Windows.InputMan.CalculatorOperation.Subtract. Subtracts.
Multiply, Shift+Oem1 GrapeCity.Windows.InputMan.CalculatorOperation.Multiply. Multiplies.
Divide, OemQuestion GrapeCity.Windows.InputMan.CalculatorOperation.Divide. Divides.
Shift+D5 GrapeCity.Windows.InputMan.CalculatorOperation.Percentage. Displays the result of multiplication as a percentage. Enter one number, click *, enter the second number, and then click %. For example, 50 * 25% will display 12.5. You can also perform operations with percentages. Enter one number, click the operator (+, -, *, or /), enter the second number, click %, and then click =..
OemTilde GrapeCity.Windows.InputMan.CalculatorOperation.SquareRoot. Calculates the square root of the displayed number.
R GrapeCity.Windows.InputMan.CalculatorOperation.Reciprocal. Calculates the reciprocal of the displayed number.
Return, Shift+OemMinus GrapeCity.Windows.InputMan.CalculatorOperation.Equal. Performs any operation on the previous two numbers. To repeat the last operation, click = again.
Ctrl+L GrapeCity.Windows.InputMan.CalculatorOperation.MemoryClear. Clears any number stored in memory.
Ctrl+R GrapeCity.Windows.InputMan.CalculatorOperation.MemoryRecall. Recalls the number stored in memory. The number remains in memory.
Ctrl+M GrapeCity.Windows.InputMan.CalculatorOperation.MemorySave. Stores the displayed number in memory.
Ctrl+P GrapeCity.Windows.InputMan.CalculatorOperation.MemoryPlus. Adds the displayed number to any number already in memory but does not display the sum of these numbers.
Ctrl+Q GrapeCity.Windows.InputMan.CalculatorOperation.MemoryMinus. Subtracts the displayed number from any number already in memory but does not display the result of the subtraction.

Supported VisualState list:

VisualStateGroup Name

VisualState Name

Description

CommonStates

Normal

Represents the visual appearance when control is in normal state.

CommonStates

Disabled

Represents the visual appearance when IsEnabled is false.

CalculationStates

HasErrors

Represents the visual appearance when HasError is true.

CalculationStates

Empty

Represents the visual appearance when HasError is false.

ValidationStates

Valid

Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns false.

ValidationStates

InvalidFocused

Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns true and IsKeyboardFocused is true.

ValidationStates

InvalidUnfocused

Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns true and IsKeyboardFocused is false.

Constructors

Name Description
GcDropDownCalculator()

Initializes a new instance of the GcDropDownCalculator class.

Fields

Name Description
DisplayTextProperty

Identifies the DisplayText dependency property.

EditButtonStyleProperty

Identifies the EditButtonStyle dependency property.

ErrorMessageStyleProperty

Identifies the ErrorMessageStyle dependency property.

HasErrorProperty

Identifies the HasError dependency property.

HasMemoryProperty

Identifies the HasMemory dependency property.

HistoryProperty

Identifies the History dependency property.

HistoryStyleProperty

Identifies the HistoryStyle dependency property.

IsShowHistoryProperty

Identifies the IsShowHistory dependency property.

MathButtonStyleProperty

Identifies the MathButtonStyle dependency property.

MemoryButtonStyleProperty

Identifies the MemoryButtonStyle dependency property.

MemoryStatusStyleProperty

Identifies the MemoryStatusStyle dependency property.

NumericButtonStyleProperty

Identifies the NumericButtonStyle dependency property.

OutputStyleProperty

Identifies the OutputStyle dependency property.

ResetButtonStyleProperty

Identifies the ResetButtonStyle dependency property.

ValueChangedEvent

Identifies the ValueChanged routed event.

ValueProperty

Identifies the Value dependency property.

Properties

Name Description
DisplayText

Gets the display text of a GcDropDownCalculator. This is a dependency property.

EditButtonStyle

Gets or sets a Style which is used to render the Edit buttons. This is a dependency property.

ErrorMessageStyle

Gets or sets a Style which is used to render the error message part. This is a dependency property.

HasError

Gets a value indicating whether this instance of GcDropDownCalculator has an error. This is a dependency property.

HasMemory

Gets a value indicating whether this instance of GcDropDownCalculator has memorized value. This is a dependency property.

History

Gets the history text string for current calculation. This is a dependency property.

HistoryStyle

Gets or sets a Style which is used to render the history part. This is a dependency property.

IsShowHistory

Gets or sets whether to show the history of calculation or not. This is a dependency property.

MathButtonStyle

Gets or sets a Style which is used to render the Math buttons. This is a dependency property.

MemoryButtonStyle

Gets or sets a Style which is used to render the Memory buttons. This is a dependency property.

MemoryStatusStyle

Gets or sets a Style which is used to render the memory status part. This is a dependency property.

NumericButtonStyle

Gets or sets a Style which is used to render the Numeric buttons. This is a dependency property.

OutputStyle

Gets or sets a Style which is used to render the output part. This is a dependency property.

ProcessCommand

Represents the ProcessCommand command, which requests that calculator to process the operation the command parameter describes.

ResetButtonStyle

Gets or sets a Style which is used to render the Reset buttons. This is a dependency property.

Value

Gets or sets the value of a GcDropDownCalculator. This is a dependency property.

Methods

Name Description
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)

Invoked just before the IsKeyboardFocusWithinChanged event is raised by this element. Implement this method to add class handling for this event.

OnValueChanged(RoutedEventArgs)

Called when value of this calculator changed, to raise the ValueChanged event.

Events

Name Description
ValueChanged

Occurs when the value of the calculator changed.