Browse Source

InputBase and UpDownBase controls: BREAKING CHANGE - renamed IsEditable to IsReadOnly and implemented accordingly.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
19ea540264
  1. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/CalculatorUpDown/Themes/Generic.xaml
  2. 14
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/InputBase.cs
  3. 10
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/UpDownBase.cs
  4. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Themes/Generic.xaml
  5. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs
  6. 7
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Themes/Generic.xaml
  7. 2
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Themes/Generic.xaml

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

@ -90,7 +90,7 @@
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
MinWidth="20" AcceptsReturn="False"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="NoWrap"

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

@ -20,16 +20,16 @@ namespace Microsoft.Windows.Controls.Primitives
#endregion //CultureInfo
#region IsEditable
#region IsReadOnly
public static readonly DependencyProperty IsEditableProperty = DependencyProperty.Register("IsEditable", typeof(bool), typeof(InputBase), new PropertyMetadata(true));
public bool IsEditable
public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(InputBase), new UIPropertyMetadata(false));
public bool IsReadOnly
{
get { return (bool)GetValue(IsEditableProperty); }
set { SetValue(IsEditableProperty, value); }
get { return (bool)GetValue(IsReadOnlyProperty); }
set { SetValue(IsReadOnlyProperty, value); }
}
#endregion //IsEditable
#endregion //IsReadOnly
#region Text
@ -62,7 +62,7 @@ namespace Microsoft.Windows.Controls.Primitives
get { return (TextAlignment)GetValue(TextAlignmentProperty); }
set { SetValue(TextAlignmentProperty, value); }
}
#endregion //TextAlignment

10
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/UpDownBase.cs

@ -138,21 +138,21 @@ namespace Microsoft.Windows.Controls.Primitives
{
case Key.Up:
{
if (AllowSpin)
if (AllowSpin && !IsReadOnly)
DoIncrement();
e.Handled = true;
break;
}
case Key.Down:
{
if (AllowSpin)
if (AllowSpin && !IsReadOnly)
DoDecrement();
e.Handled = true;
break;
}
case Key.Enter:
{
if (IsEditable)
if (!IsReadOnly)
{
var binding = BindingOperations.GetBindingExpression(TextBox, System.Windows.Controls.TextBox.TextProperty);
binding.UpdateSource();
@ -166,7 +166,7 @@ namespace Microsoft.Windows.Controls.Primitives
{
base.OnMouseWheel(e);
if (!e.Handled && AllowSpin && ((TextBox.IsFocused && MouseWheelActiveOnFocus) || !MouseWheelActiveOnFocus))
if (!e.Handled && AllowSpin && !IsReadOnly && ((TextBox.IsFocused && MouseWheelActiveOnFocus) || !MouseWheelActiveOnFocus))
{
if (e.Delta < 0)
{
@ -192,7 +192,7 @@ namespace Microsoft.Windows.Controls.Primitives
private void OnSpinnerSpin(object sender, SpinEventArgs e)
{
if (AllowSpin)
if (AllowSpin && !IsReadOnly)
OnSpin(e);
}

2
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Themes/Generic.xaml

@ -91,7 +91,7 @@
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
MinWidth="20" AcceptsReturn="False"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="NoWrap"

2
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs

@ -155,7 +155,7 @@ namespace Microsoft.Windows.Controls
{
case Key.Enter:
{
if (IsEditable)
if (!IsReadOnly)
{
_fireSelectionChangedEvent = false;
BindingExpression binding = BindingOperations.GetBindingExpression(TextBox, System.Windows.Controls.TextBox.TextProperty);

7
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Themes/Generic.xaml

@ -1,9 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Microsoft.Windows.Controls"
xmlns:coreConverters="clr-namespace:Microsoft.Windows.Controls.Core.Converters">
<coreConverters:InverseBoolConverter x:Key="InverseBoolConverter" />
xmlns:local="clr-namespace:Microsoft.Windows.Controls">
<DataTemplate x:Key="DefaultWatermarkTemplate">
<ContentControl Content="{Binding}" Foreground="Gray" Focusable="False" />
@ -36,7 +33,7 @@
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
MinWidth="20" AcceptsReturn="False"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="NoWrap"

2
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Themes/Generic.xaml

@ -32,7 +32,7 @@
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsReadOnly="{Binding IsEditable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
MinWidth="20" AcceptsReturn="False"
SelectAllOnGotFocus="{Binding SelectAllOnGotFocus, RelativeSource={RelativeSource TemplatedParent}}"
TextAlignment="{Binding TextAlignment, RelativeSource={RelativeSource TemplatedParent}}"

Loading…
Cancel
Save