Browse Source

InputBase: Renamed DisplayText back to Text. made more sense and I didn't want to go change all the documentation to DisplayText :0P

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
05b6f8024d
  1. 46
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/InputBase.cs
  2. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/MaskedTextBox.cs
  3. 4
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/NumericUpDown.cs
  4. 4
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml
  5. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/UpDownBase/UpDownBase.cs

46
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/InputBase.cs

@ -20,40 +20,40 @@ namespace Microsoft.Windows.Controls.Primitives
public virtual object PreviousValue { get; internal set; } public virtual object PreviousValue { get; internal set; }
#region DisplayText #region IsEditable
public static readonly DependencyProperty IsEditableProperty = DependencyProperty.Register("IsEditable", typeof(bool), typeof(InputBase), new PropertyMetadata(true));
public bool IsEditable
{
get { return (bool)GetValue(IsEditableProperty); }
set { SetValue(IsEditableProperty, value); }
}
#endregion //IsEditable
#region Text
public static readonly DependencyProperty DisplayTextProperty = DependencyProperty.Register("DisplayText", typeof(string), typeof(InputBase), new FrameworkPropertyMetadata(default(String), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnDisplayTextPropertyChanged)); public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(InputBase), new FrameworkPropertyMetadata(default(String), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnTextPropertyChanged));
public string DisplayText public string Text
{ {
get { return (string)this.GetValue(DisplayTextProperty); } get { return (string)this.GetValue(TextProperty); }
set { this.SetValue(DisplayTextProperty, value); } set { this.SetValue(TextProperty, value); }
} }
private static void OnDisplayTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
InputBase input = (InputBase)d; InputBase input = (InputBase)d;
input.OnDisplayTextChanged((string)e.OldValue, (string)e.NewValue); input.OnTextChanged((string)e.OldValue, (string)e.NewValue);
if (input._isInitialized) if (input._isInitialized)
input.SyncTextAndValueProperties(e.Property, e.NewValue); input.SyncTextAndValueProperties(e.Property, e.NewValue);
} }
protected virtual void OnDisplayTextChanged(string previousValue, string currentValue) protected virtual void OnTextChanged(string previousValue, string currentValue)
{ {
} }
#endregion //DisplayText #endregion //Text
#region IsEditable
public static readonly DependencyProperty IsEditableProperty = DependencyProperty.Register("IsEditable", typeof(bool), typeof(InputBase), new PropertyMetadata(true));
public bool IsEditable
{
get { return (bool)GetValue(IsEditableProperty); }
set { SetValue(IsEditableProperty, value); }
}
#endregion //IsEditable
#region Value #region Value
@ -117,7 +117,7 @@ namespace Microsoft.Windows.Controls.Primitives
protected virtual void OnValueTypeChanged(Type oldValue, Type newType) protected virtual void OnValueTypeChanged(Type oldValue, Type newType)
{ {
if (_isInitialized) if (_isInitialized)
SyncTextAndValueProperties(DisplayTextProperty, DisplayText); SyncTextAndValueProperties(TextProperty, Text);
} }
#endregion //ValueType #endregion //ValueType
@ -150,12 +150,12 @@ namespace Microsoft.Windows.Controls.Primitives
_isSyncingTextAndValueProperties = true; _isSyncingTextAndValueProperties = true;
//this only occures when the user typed in the value //this only occures when the user typed in the value
if (InputBase.DisplayTextProperty == p) if (InputBase.TextProperty == p)
{ {
SetValue(InputBase.ValueProperty, ConvertTextToValue(newValue.ToString())); SetValue(InputBase.ValueProperty, ConvertTextToValue(newValue.ToString()));
} }
SetValue(InputBase.DisplayTextProperty, ConvertValueToText(newValue)); SetValue(InputBase.TextProperty, ConvertValueToText(newValue));
_isSyncingTextAndValueProperties = false; _isSyncingTextAndValueProperties = false;
} }

2
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/MaskedTextBox.cs

@ -229,7 +229,7 @@ namespace Microsoft.Windows.Controls
private void UpdateText(MaskedTextProvider provider, int position) private void UpdateText(MaskedTextProvider provider, int position)
{ {
DisplayText = provider.ToDisplayString(); Text = provider.ToDisplayString();
if (TextBox != null) if (TextBox != null)
TextBox.SelectionStart = position; TextBox.SelectionStart = position;

4
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/NumericUpDown.cs

@ -70,7 +70,7 @@ namespace Microsoft.Windows.Controls
protected virtual void OnStringFormatChanged(string oldValue, string newValue) protected virtual void OnStringFormatChanged(string oldValue, string newValue)
{ {
SyncTextAndValueProperties(NumericUpDown.DisplayTextProperty, Value); SyncTextAndValueProperties(NumericUpDown.TextProperty, Value);
} }
#endregion //FormatString #endregion //FormatString
@ -133,7 +133,7 @@ namespace Microsoft.Windows.Controls
} }
catch catch
{ {
TextBox.Text = DisplayText = ConvertValueToText(Value); TextBox.Text = Text = ConvertValueToText(Value);
return Value; return Value;
} }

4
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml

@ -1104,7 +1104,7 @@
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
MinWidth="20" AcceptsReturn="False" MinWidth="20" AcceptsReturn="False"
TextAlignment="Right" TextWrapping="NoWrap" TextAlignment="Right" TextWrapping="NoWrap"
Text="{Binding DisplayText, RelativeSource={RelativeSource TemplatedParent}}" /> Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" />
</local:ButtonSpinner> </local:ButtonSpinner>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
@ -1128,7 +1128,7 @@
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
MinWidth="20" AcceptsReturn="False" TextWrapping="NoWrap" MinWidth="20" AcceptsReturn="False" TextWrapping="NoWrap"
Text="{Binding DisplayText, RelativeSource={RelativeSource TemplatedParent}}" /> Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>

2
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/UpDownBase/UpDownBase.cs

@ -72,7 +72,7 @@ namespace Microsoft.Windows.Controls
} }
case Key.Enter: case Key.Enter:
{ {
SyncTextAndValueProperties(InputBase.DisplayTextProperty, TextBox.Text); SyncTextAndValueProperties(UpDownBase.TextProperty, TextBox.Text);
break; break;
} }
} }

Loading…
Cancel
Save