Browse Source

CalculatorUpDown: added DisplayText, Memory, and Precision properties.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
28b2201a2a
  1. 33
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/CalculatorUpDown/Implementation/CalculatorUpDown.cs
  2. 6
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/CalculatorUpDown/Themes/Generic.xaml

33
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/CalculatorUpDown/Implementation/CalculatorUpDown.cs

@ -16,6 +16,17 @@ namespace Microsoft.Windows.Controls
#region Properties
#region DisplayText
public static readonly DependencyProperty DisplayTextProperty = DependencyProperty.Register("DisplayText", typeof(string), typeof(CalculatorUpDown), new UIPropertyMetadata("0"));
public string DisplayText
{
get { return (string)GetValue(DisplayTextProperty); }
set { SetValue(DisplayTextProperty, value); }
}
#endregion //DisplayText
#region EnterClosesCalculator
public static readonly DependencyProperty EnterClosesCalculatorProperty = DependencyProperty.Register("EnterClosesCalculator", typeof(bool), typeof(CalculatorUpDown), new UIPropertyMetadata(false));
@ -50,6 +61,28 @@ namespace Microsoft.Windows.Controls
#endregion //IsOpen
#region Memory
public static readonly DependencyProperty MemoryProperty = DependencyProperty.Register("Memory", typeof(decimal), typeof(CalculatorUpDown), new UIPropertyMetadata(default(decimal)));
public decimal Memory
{
get { return (decimal)GetValue(MemoryProperty); }
set { SetValue(MemoryProperty, value); }
}
#endregion //Memory
#region Precision
public static readonly DependencyProperty PrecisionProperty = DependencyProperty.Register("Precision", typeof(int), typeof(CalculatorUpDown), new UIPropertyMetadata(6));
public int Precision
{
get { return (int)GetValue(PrecisionProperty); }
set { SetValue(PrecisionProperty, value); }
}
#endregion //Precision
#endregion //Properties
#region Constructors

6
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/CalculatorUpDown/Themes/Generic.xaml

@ -101,7 +101,11 @@
<Popup x:Name="PART_CalculatorPopup" IsOpen="{Binding IsChecked, ElementName=_calculatorToggleButton}" StaysOpen="False">
<Border BorderThickness="1" Background="{StaticResource PopupBackgroundBrush}" BorderBrush="{StaticResource PopupDarkBorderBrush}" Padding="3">
<StackPanel>
<local:Calculator x:Name="PART_Calculator" Background="Transparent" BorderThickness="0" Value="{Binding Value, RelativeSource={RelativeSource TemplatedParent}}" />
<local:Calculator x:Name="PART_Calculator" Background="Transparent" BorderThickness="0"
DisplayText="{Binding DisplayText, RelativeSource={RelativeSource TemplatedParent}}"
Memory="{Binding Memory, RelativeSource={RelativeSource TemplatedParent}}"
Precision="{Binding Precision, RelativeSource={RelativeSource TemplatedParent}}"
Value="{Binding Value, RelativeSource={RelativeSource TemplatedParent}}" />
</StackPanel>
</Border>
</Popup>

Loading…
Cancel
Save