optimized performance

This commit is contained in:
NaBian committed 2020-06-28 22:39:27 +08:00
1 parent c407997a3c
commit 3162267795
65 files changed
+168 -168

No files matched your search

@@ -67,7 +67,7 @@ namespace HandyControl.Controls
public bool IsSelected
{
get => (bool)GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SelfManageProperty = DependencyProperty.Register(
@@ -76,7 +76,7 @@ namespace HandyControl.Controls
public bool SelfManage
{
get => (bool) GetValue(SelfManageProperty);
set => SetValue(SelfManageProperty, value);
set => SetValue(SelfManageProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty CanDeselectProperty = DependencyProperty.Register(
@@ -85,7 +85,7 @@ namespace HandyControl.Controls
public bool CanDeselect
{
get => (bool) GetValue(CanDeselectProperty);
set => SetValue(CanDeselectProperty, value);
set => SetValue(CanDeselectProperty, ValueBoxes.BooleanBox(value));
}
public static readonly RoutedEvent SelectedEvent =
@@ -38,7 +38,7 @@ namespace HandyControl.Controls
{
if (e.NewItems != null && e.NewItems.Count > 0)
{
SetValue(HasItemsPropertyKey, true);
SetValue(HasItemsPropertyKey, ValueBoxes.TrueBox);
}
OnItemsChanged(s, e);
};
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
public bool Runaway
{
get => (bool) GetValue(RunawayProperty);
set => SetValue(RunawayProperty, value);
set => SetValue(RunawayProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
@@ -45,7 +45,7 @@ namespace HandyControl.Controls
public bool AutoRun
{
get => (bool) GetValue(AutoRunProperty);
set => SetValue(AutoRunProperty, value);
set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
@@ -93,7 +93,7 @@ namespace HandyControl.Controls
public bool IsRunning
{
get => (bool) GetValue(IsRunningProperty);
set => SetValue(IsRunningProperty, value);
set => SetValue(IsRunningProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty AutoReverseProperty = DependencyProperty.Register(
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
public bool AutoReverse
{
get => (bool) GetValue(AutoReverseProperty);
set => SetValue(AutoReverseProperty, value);
set => SetValue(AutoReverseProperty, ValueBoxes.BooleanBox(value));
}
private void UpdateContent()
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen
{
get => (bool) GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty DropDownContentProperty = DependencyProperty.Register(
@@ -104,7 +104,7 @@ namespace HandyControl.Controls
public bool IsCenter
{
get => (bool)GetValue(IsCenterProperty);
set => SetValue(IsCenterProperty, value);
set => SetValue(IsCenterProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty PageButtonStyleProperty = DependencyProperty.Register(
@@ -161,7 +161,7 @@ namespace HandyControl.Controls
public bool AutoRun
{
get => (bool)GetValue(AutoRunProperty);
set => SetValue(AutoRunProperty, value);
set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -123,7 +123,7 @@ namespace HandyControl.Controls
public bool Loop
{
get => (bool)GetValue(LoopProperty);
set => SetValue(LoopProperty, value);
set => SetValue(LoopProperty, ValueBoxes.BooleanBox(value));
}
public override void OnApplyTemplate()
@@ -146,7 +146,7 @@ namespace HandyControl.Controls
public bool ItemContentHeightFixed
{
get => (bool)GetValue(ItemContentHeightFixedProperty);
set => SetValue(ItemContentHeightFixedProperty, value);
set => SetValue(ItemContentHeightFixedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ItemHeaderTemplateProperty = DependencyProperty.Register(
@@ -24,7 +24,7 @@ namespace HandyControl.Controls
public bool IsClosed
{
get => (bool)GetValue(IsClosedProperty);
internal set => SetValue(IsClosedProperty, value);
internal set => SetValue(IsClosedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty TokenProperty = DependencyProperty.RegisterAttached(
@@ -234,7 +234,7 @@ namespace HandyControl.Controls
public bool ShowDateTime
{
get => (bool)GetValue(ShowDateTimeProperty);
set => SetValue(ShowDateTimeProperty, value);
set => SetValue(ShowDateTimeProperty, ValueBoxes.BooleanBox(value));
}
public string Message
@@ -143,7 +143,7 @@ namespace HandyControl.Controls
public bool IsPlaying
{
get => (bool) GetValue(IsPlayingProperty);
set => SetValue(IsPlayingProperty, value);
set => SetValue(IsPlayingProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ColumnsProperty = DependencyProperty.Register(
@@ -271,13 +271,13 @@ namespace HandyControl.Controls
public bool IsFullScreen
{
get => (bool)GetValue(IsFullScreenProperty);
set => SetValue(IsFullScreenProperty, value);
set => SetValue(IsFullScreenProperty, ValueBoxes.BooleanBox(value));
}
public bool ShowImgMap
{
get => (bool)GetValue(ShowImgMapProperty);
set => SetValue(ShowImgMapProperty, value);
set => SetValue(ShowImgMapProperty, ValueBoxes.BooleanBox(value));
}
public BitmapFrame ImageSource
@@ -310,7 +310,7 @@ namespace HandyControl.Controls
internal bool ShowFullScreenButton
{
get => (bool)GetValue(ShowFullScreenButtonProperty);
set => SetValue(ShowFullScreenButtonProperty, value);
set => SetValue(ShowFullScreenButtonProperty, ValueBoxes.BooleanBox(value));
}
internal Thickness ImageMargin
@@ -352,7 +352,7 @@ namespace HandyControl.Controls
internal bool ShowSmallImgInternal
{
get => (bool)GetValue(ShowSmallImgInternalProperty);
set => SetValue(ShowSmallImgInternalProperty, value);
set => SetValue(ShowSmallImgInternalProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -371,7 +371,7 @@ namespace HandyControl.Controls
internal bool ShowCloseButton
{
get => (bool)GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value);
set => SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -169,7 +169,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -220,7 +220,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -339,7 +339,7 @@ namespace HandyControl.Controls
public bool AutoComplete
{
get => (bool)GetValue(AutoCompleteProperty);
set => SetValue(AutoCompleteProperty, value);
set => SetValue(AutoCompleteProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -51,7 +51,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -78,7 +78,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public virtual bool VerifyData()
@@ -153,7 +153,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen
{
get => (bool) GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register(
@@ -238,7 +238,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -265,7 +265,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
#endregion
@@ -120,7 +120,7 @@ namespace HandyControl.Controls
public bool HasValue
{
get => (bool) GetValue(HasValueProperty);
set => SetValue(HasValueProperty, value);
set => SetValue(HasValueProperty, ValueBoxes.BooleanBox(value));
}
}
}
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
internal bool ShowUpDownButton
{
get => (bool)GetValue(ShowUpDownButtonProperty);
set => SetValue(ShowUpDownButtonProperty, value);
set => SetValue(ShowUpDownButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -333,7 +333,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -372,7 +372,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -387,7 +387,7 @@ namespace HandyControl.Controls
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
}
public Func<string, OperationResult<bool>> VerifyFunc { get; set; }
@@ -20,6 +20,11 @@ namespace HandyControl.Controls
private const string ElementTextBox = "PART_TextBox";
private SecureString _password;
private System.Windows.Controls.TextBox _textBox;
/// <summary>
/// 掩码字符
/// </summary>
@@ -27,46 +32,81 @@ namespace HandyControl.Controls
System.Windows.Controls.PasswordBox.PasswordCharProperty.AddOwner(typeof(PasswordBox),
new FrameworkPropertyMetadata('●'));
public char PasswordChar
{
get => (char)GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value);
}
/// <summary>
/// 数据是否错误
/// </summary>
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register(
"IsError", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
/// 错误提示
/// </summary>
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
"ErrorStr", typeof(string), typeof(PasswordBox), new PropertyMetadata(default(string)));
public string ErrorStr
{
get => (string)GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value);
}
/// <summary>
/// 文本类型
/// </summary>
public static readonly DependencyProperty TextTypeProperty = DependencyProperty.Register(
"TextType", typeof(TextType), typeof(PasswordBox), new PropertyMetadata(default(TextType)));
public TextType TextType
{
get => (TextType)GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value);
}
/// <summary>
/// 是否显示清除按钮
/// </summary>
public static readonly DependencyProperty ShowClearButtonProperty = DependencyProperty.Register(
"ShowClearButton", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowEyeButtonProperty = DependencyProperty.Register(
"ShowEyeButton", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool ShowEyeButton
{
get => (bool)GetValue(ShowEyeButtonProperty);
set => SetValue(ShowEyeButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowPasswordProperty = DependencyProperty.Register(
"ShowPassword", typeof(bool), typeof(PasswordBox),
new PropertyMetadata(ValueBoxes.FalseBox, OnShowPasswordChanged));
private SecureString _password;
private System.Windows.Controls.TextBox _textBox;
public PasswordBox()
public bool ShowPassword
{
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => Clear()));
get => (bool)GetValue(ShowPasswordProperty);
set => SetValue(ShowPasswordProperty, ValueBoxes.BooleanBox(value));
}
public PasswordBox() => CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => Clear()));
public System.Windows.Controls.PasswordBox ActualPasswordBox { get; set; }
[DefaultValue("")]
@@ -101,50 +141,8 @@ namespace HandyControl.Controls
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SecureString SecurePassword => ActualPasswordBox?.SecurePassword;
public char PasswordChar
{
get => (char) GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value);
}
public bool ShowEyeButton
{
get => (bool) GetValue(ShowEyeButtonProperty);
set => SetValue(ShowEyeButtonProperty, value);
}
public bool ShowPassword
{
get => (bool) GetValue(ShowPasswordProperty);
set => SetValue(ShowPasswordProperty, value);
}
public Func<string, OperationResult<bool>> VerifyFunc { get; set; }
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
}
public string ErrorStr
{
get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value);
}
public TextType TextType
{
get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value);
}
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
}
public virtual bool VerifyData()
{
OperationResult<bool> result;
@@ -77,7 +77,7 @@ namespace HandyControl.Controls
public bool IsRealTime
{
get => (bool)GetValue(IsRealTimeProperty);
set => SetValue(IsRealTimeProperty, value);
set => SetValue(IsRealTimeProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -72,7 +72,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public virtual bool VerifyData()
@@ -130,7 +130,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen
{
get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsDropDownOpenProperty =
@@ -262,7 +262,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -289,7 +289,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ClockProperty = DependencyProperty.Register(
@@ -31,7 +31,7 @@ namespace HandyControl.Controls
public bool IsRunning
{
get => (bool) GetValue(IsRunningProperty);
set => SetValue(IsRunningProperty, value);
set => SetValue(IsRunningProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty DotCountProperty = DependencyProperty.Register(
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using HandyControl.Data;
namespace HandyControl.Controls
@@ -27,7 +28,7 @@ namespace HandyControl.Controls
public bool NeedHidden
{
get => (bool) GetValue(NeedHiddenProperty);
set => SetValue(NeedHiddenProperty, value);
set => SetValue(NeedHiddenProperty, ValueBoxes.BooleanBox(value));
}
static LoadingCircle()
@@ -100,7 +100,7 @@ namespace HandyControl.Controls
public bool IsPlaying
{
get => (bool)GetValue(IsPlayingProperty);
set => SetValue(IsPlayingProperty, value);
set => SetValue(IsPlayingProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty RepeatBehaviorProperty = DependencyProperty.Register(
@@ -86,7 +86,7 @@ namespace HandyControl.Controls
public bool ShowBadge
{
get => (bool) GetValue(ShowBadgeProperty);
set => SetValue(ShowBadgeProperty, value);
set => SetValue(ShowBadgeProperty, ValueBoxes.BooleanBox(value));
}
protected override Geometry GetLayoutClip(Size layoutSlotSize) => null;
@@ -30,7 +30,7 @@ namespace HandyControl.Controls
public bool IsRead
{
get => (bool) GetValue(IsReadProperty);
set => SetValue(IsReadProperty, value);
set => SetValue(IsReadProperty, ValueBoxes.BooleanBox(value));
}
public static void SetMaxWidth(DependencyObject element, double value)
@@ -109,7 +109,7 @@ namespace HandyControl.Controls
public bool IsOpen
{
get => (bool) GetValue(IsOpenProperty);
set => SetValue(IsOpenProperty, value);
set => SetValue(IsOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty MaskCanCloseProperty = DependencyProperty.Register(
@@ -118,7 +118,7 @@ namespace HandyControl.Controls
public bool MaskCanClose
{
get => (bool) GetValue(MaskCanCloseProperty);
set => SetValue(MaskCanCloseProperty, value);
set => SetValue(MaskCanCloseProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowMaskProperty = DependencyProperty.Register(
@@ -127,7 +127,7 @@ namespace HandyControl.Controls
public bool ShowMask
{
get => (bool) GetValue(ShowMaskProperty);
set => SetValue(ShowMaskProperty, value);
set => SetValue(ShowMaskProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty DockProperty = DependencyProperty.Register(
@@ -60,7 +60,7 @@ namespace HandyControl.Controls
public bool Animated
{
get => (bool) GetValue(AnimatedProperty);
set => SetValue(AnimatedProperty, value);
set => SetValue(AnimatedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty AnimationTimeProperty = DependencyProperty.Register(
@@ -87,7 +87,7 @@ namespace HandyControl.Controls
public bool AutoHiding
{
get => (bool) GetValue(AutoHidingProperty);
set => SetValue(AutoHidingProperty, value);
set => SetValue(AutoHidingProperty, ValueBoxes.BooleanBox(value));
}
protected override void OnClick()
@@ -335,7 +335,7 @@ namespace HandyControl.Controls
public bool IsBlink
{
get => (bool)GetValue(IsBlinkProperty);
set => SetValue(IsBlinkProperty, value);
set => SetValue(IsBlinkProperty, ValueBoxes.BooleanBox(value));
}
private void DispatcherTimerBlinkTick(object sender, EventArgs e)
@@ -231,7 +231,7 @@ namespace HandyControl.Controls
public bool IsJumpEnabled
{
get => (bool) GetValue(IsJumpEnabledProperty);
set => SetValue(IsJumpEnabledProperty, value);
set => SetValue(IsJumpEnabledProperty, ValueBoxes.BooleanBox(value));
}
#endregion
@@ -145,7 +145,7 @@ namespace HandyControl.Controls
public bool IsOpen
{
get => (bool) GetValue(IsOpenProperty);
set => SetValue(IsOpenProperty, value);
set => SetValue(IsOpenProperty, ValueBoxes.BooleanBox(value));
}
public static Poptip Default => new Poptip();
@@ -44,7 +44,7 @@ namespace HandyControl.Controls
public bool CanMouseWheel
{
get => (bool) GetValue(CanMouseWheelProperty);
set => SetValue(CanMouseWheelProperty, value);
set => SetValue(CanMouseWheelProperty, ValueBoxes.BooleanBox(value));
}
protected override void OnMouseWheel(MouseWheelEventArgs e)
@@ -155,7 +155,7 @@ namespace HandyControl.Controls
public bool IsInertiaEnabled
{
get => (bool) GetValue(IsInertiaEnabledProperty);
set => SetValue(IsInertiaEnabledProperty, value);
set => SetValue(IsInertiaEnabledProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -170,7 +170,7 @@ namespace HandyControl.Controls
public bool IsPenetrating
{
get => (bool) GetValue(IsPenetratingProperty);
set => SetValue(IsPenetratingProperty, value);
set => SetValue(IsPenetratingProperty, ValueBoxes.BooleanBox(value));
}
public static void SetIsPenetrating(DependencyObject element, bool value) => element.SetValue(IsPenetratingProperty, ValueBoxes.BooleanBox(value));
@@ -77,7 +77,7 @@ namespace HandyControl.Controls
public bool AutoSizeEnabled
{
get => (bool) GetValue(AutoSizeEnabledProperty);
set => SetValue(AutoSizeEnabledProperty, value);
set => SetValue(AutoSizeEnabledProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty MarkMarginProperty = DependencyProperty.Register(
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
public bool KeepVertical
{
get => (bool) GetValue(KeepVerticalProperty);
set => SetValue(KeepVerticalProperty, value);
set => SetValue(KeepVerticalProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty OffsetAngleProperty = DependencyProperty.Register(
@@ -47,7 +47,7 @@ namespace HandyControl.Controls
public bool IsFixed
{
get => (bool) GetValue(IsFixedProperty);
set => SetValue(IsFixedProperty, value);
set => SetValue(IsFixedProperty, ValueBoxes.BooleanBox(value));
}
internal int GetLayoutCellCount(ColLayoutStatus status)
@@ -38,7 +38,7 @@ namespace HandyControl.Controls
public bool ShowText
{
get => (bool) GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, value);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
}
public double ArcThickness
@@ -86,7 +86,7 @@ namespace HandyControl.Controls
public bool ShowText
{
get => (bool)GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, value);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty WaveFillProperty = DependencyProperty.Register(
@@ -5,6 +5,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Shapes;
using HandyControl.Data;
using HandyControl.Tools;
namespace HandyControl.Controls
@@ -35,7 +36,7 @@ namespace HandyControl.Controls
var factory = new FrameworkElementFactory(typeof(Path));
factory.SetValue(FrameworkElement.WidthProperty, 12.0);
factory.SetValue(FrameworkElement.HeightProperty, 10.0);
factory.SetValue(FrameworkElement.HeightProperty, ValueBoxes.Double10Box);
factory.SetBinding(Shape.FillProperty, new Binding(Control.ForegroundProperty.Name)
{
RelativeSource = new RelativeSource
@@ -5,6 +5,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Shapes;
using HandyControl.Data;
using HandyControl.Tools;
namespace HandyControl.Controls
@@ -34,7 +35,7 @@ namespace HandyControl.Controls
};
var factory = new FrameworkElementFactory(typeof(Path));
factory.SetValue(FrameworkElement.WidthProperty, 10.0);
factory.SetValue(FrameworkElement.WidthProperty, ValueBoxes.Double10Box);
factory.SetValue(FrameworkElement.HeightProperty, 12.0);
factory.SetBinding(Shape.FillProperty, new Binding(Control.ForegroundProperty.Name)
{
@@ -68,7 +68,7 @@ namespace HandyControl.Controls
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register(
@@ -113,7 +113,7 @@ namespace HandyControl.Controls
public bool IsSelected
{
get => (bool)GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsExpandedEnabledProperty = DependencyProperty.Register(
@@ -122,7 +122,7 @@ namespace HandyControl.Controls
public bool IsExpandedEnabled
{
get => (bool)GetValue(IsExpandedEnabledProperty);
set => SetValue(IsExpandedEnabledProperty, value);
set => SetValue(IsExpandedEnabledProperty, ValueBoxes.BooleanBox(value));
}
public PropertyDescriptor PropertyDescriptor { get; set; }
@@ -108,13 +108,13 @@ namespace HandyControl.Controls
public bool AllowHalf
{
get => (bool) GetValue(AllowHalfProperty);
set => SetValue(AllowHalfProperty, value);
set => SetValue(AllowHalfProperty, ValueBoxes.BooleanBox(value));
}
public bool AllowClear
{
get => (bool) GetValue(AllowClearProperty);
set => SetValue(AllowClearProperty, value);
set => SetValue(AllowClearProperty, ValueBoxes.BooleanBox(value));
}
public Geometry Icon
@@ -150,13 +150,13 @@ namespace HandyControl.Controls
public bool ShowText
{
get => (bool) GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, value);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
}
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
}
private void RateItemValueChanged(object sender, RoutedEventArgs e) =>
@@ -58,13 +58,13 @@ namespace HandyControl.Controls
public bool AllowClear
{
get => (bool) GetValue(AllowClearProperty);
set => SetValue(AllowClearProperty, value);
set => SetValue(AllowClearProperty, ValueBoxes.BooleanBox(value));
}
public bool AllowHalf
{
get => (bool) GetValue(AllowHalfProperty);
set => SetValue(AllowHalfProperty, value);
set => SetValue(AllowHalfProperty, ValueBoxes.BooleanBox(value));
}
public Geometry Icon
@@ -76,13 +76,13 @@ namespace HandyControl.Controls
internal bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
}
internal bool IsHalf
@@ -125,7 +125,7 @@ namespace HandyControl.Controls
public bool IsDrawing
{
get => (bool)GetValue(IsDrawingProperty);
internal set => SetValue(IsDrawingProperty, value);
internal set => SetValue(IsDrawingProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsSelectingProperty = DependencyProperty.Register(
@@ -134,7 +134,7 @@ namespace HandyControl.Controls
public bool IsSelecting
{
get => (bool)GetValue(IsSelectingProperty);
internal set => SetValue(IsSelectingProperty, value);
internal set => SetValue(IsSelectingProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SizeProperty = DependencyProperty.Register(
@@ -127,7 +127,7 @@ namespace HandyControl.Controls
public bool AutoSelect
{
get => (bool) GetValue(AutoSelectProperty);
set => SetValue(AutoSelectProperty, value);
set => SetValue(AutoSelectProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register(
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
public bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty RoleProperty = DependencyProperty.Register(
@@ -146,7 +146,7 @@ namespace HandyControl.Controls
public bool IsDirectionReversed
{
get => (bool)GetValue(IsDirectionReversedProperty);
set => SetValue(IsDirectionReversedProperty, value);
set => SetValue(IsDirectionReversedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty DelayProperty = RepeatButton.DelayProperty.AddOwner(typeof(RangeSlider), new FrameworkPropertyMetadata(GetKeyboardDelay()));
@@ -206,7 +206,7 @@ namespace HandyControl.Controls
public bool IsSnapToTickEnabled
{
get => (bool)GetValue(IsSnapToTickEnabledProperty);
set => SetValue(IsSnapToTickEnabledProperty, value);
set => SetValue(IsSnapToTickEnabledProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty TickPlacementProperty = DependencyProperty.Register(
@@ -243,7 +243,7 @@ namespace HandyControl.Controls
public bool IsMoveToPointEnabled
{
get => (bool)GetValue(IsMoveToPointEnabledProperty);
set => SetValue(IsMoveToPointEnabledProperty, value);
set => SetValue(IsMoveToPointEnabledProperty, ValueBoxes.BooleanBox(value));
}
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
@@ -170,7 +170,7 @@ namespace HandyControl.Controls
public bool IsDirectionReversed
{
get => (bool) GetValue(IsDirectionReversedProperty);
set => SetValue(IsDirectionReversedProperty, value);
set => SetValue(IsDirectionReversedProperty, ValueBoxes.BooleanBox(value));
}
protected override Visual GetVisualChild(int index)
@@ -59,7 +59,7 @@ namespace HandyControl.Controls
public bool IsAnimationEnabled
{
get => (bool)GetValue(IsAnimationEnabledProperty);
set => SetValue(IsAnimationEnabledProperty, value);
set => SetValue(IsAnimationEnabledProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -74,7 +74,7 @@ namespace HandyControl.Controls
public bool IsDraggable
{
get => (bool)GetValue(IsDraggableProperty);
set => SetValue(IsDraggableProperty, value);
set => SetValue(IsDraggableProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -131,7 +131,7 @@ namespace HandyControl.Controls
public bool IsTabFillEnabled
{
get => (bool)GetValue(IsTabFillEnabledProperty);
set => SetValue(IsTabFillEnabledProperty, value);
set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -176,7 +176,7 @@ namespace HandyControl.Controls
public bool IsScrollable
{
get => (bool) GetValue(IsScrollableProperty);
set => SetValue(IsScrollableProperty, value);
set => SetValue(IsScrollableProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -191,7 +191,7 @@ namespace HandyControl.Controls
public bool ShowOverflowButton
{
get => (bool) GetValue(ShowOverflowButtonProperty);
set => SetValue(ShowOverflowButtonProperty, value);
set => SetValue(ShowOverflowButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -206,7 +206,7 @@ namespace HandyControl.Controls
public bool ShowScrollButton
{
get => (bool) GetValue(ShowScrollButtonProperty);
set => SetValue(ShowScrollButtonProperty, value);
set => SetValue(ShowScrollButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -173,7 +173,7 @@ namespace HandyControl.Controls
public bool ShowContextMenu
{
get => (bool) GetValue(ShowContextMenuProperty);
set => SetValue(ShowContextMenuProperty, value);
set => SetValue(ShowContextMenuProperty, ValueBoxes.BooleanBox(value));
}
public static void SetShowContextMenu(DependencyObject element, bool value)
@@ -53,7 +53,7 @@ namespace HandyControl.Controls
public bool IsTabFillEnabled
{
get => (bool)GetValue(IsTabFillEnabledProperty);
set => SetValue(IsTabFillEnabledProperty, value);
set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -27,7 +27,7 @@ namespace HandyControl.Controls
public bool ShowCloseButton
{
get => (bool) GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value);
set => SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SelectableProperty = DependencyProperty.Register(
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
public bool Selectable
{
get => (bool) GetValue(SelectableProperty);
set => SetValue(SelectableProperty, value);
set => SetValue(SelectableProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
public bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly RoutedEvent SelectedEvent = EventManager.RegisterRoutedEvent("Selected", RoutingStrategy.Bubble, typeof(EventHandler), typeof(Tag));
@@ -45,7 +45,7 @@ namespace HandyControl.Controls
public bool ShowAddButton
{
get => (bool) GetValue(ShowAddButtonProperty);
set => SetValue(ShowAddButtonProperty, value);
set => SetValue(ShowAddButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty TagMarginProperty = DependencyProperty.Register(
@@ -87,7 +87,7 @@ namespace HandyControl.Controls
public bool ShowConfirmButton
{
get => (bool)GetValue(ShowConfirmButtonProperty);
set => SetValue(ShowConfirmButtonProperty, value);
set => SetValue(ShowConfirmButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register(
@@ -82,7 +82,7 @@ namespace HandyControl.Controls
internal bool ShowConfirmButton
{
get => (bool) GetValue(ShowConfirmButtonProperty);
set => SetValue(ShowConfirmButtonProperty, value);
set => SetValue(ShowConfirmButtonProperty, ValueBoxes.BooleanBox(value));
}
protected virtual void OnSelectedTimeChanged(FunctionEventArgs<DateTime?> e) => RaiseEvent(e);
@@ -216,7 +216,7 @@ namespace HandyControl.Controls
public bool ShowSpeStr
{
get => (bool)GetValue(ShowSpeStrProperty);
set => SetValue(ShowSpeStrProperty, value);
set => SetValue(ShowSpeStrProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -11,7 +11,7 @@ namespace HandyControl.Controls
public bool IsTransferred
{
get => (bool) GetValue(IsTransferredProperty);
set => SetValue(IsTransferredProperty, value);
set => SetValue(IsTransferredProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsOriginProperty = DependencyProperty.Register(
@@ -20,7 +20,7 @@ namespace HandyControl.Controls
public bool IsOrigin
{
get => (bool) GetValue(IsOriginProperty);
internal set => SetValue(IsOriginProperty, value);
internal set => SetValue(IsOriginProperty, ValueBoxes.BooleanBox(value));
}
}
}
@@ -61,7 +61,7 @@ namespace HandyControl.Controls
public bool ShowImage
{
get => (bool)GetValue(ShowImageProperty);
set => SetValue(ShowImageProperty, value);
set => SetValue(ShowImageProperty, ValueBoxes.BooleanBox(value));
}
private MessageBox()
@@ -109,7 +109,7 @@ namespace HandyControl.Controls
public bool ShowTitle
{
get => (bool) GetValue(ShowTitleProperty);
set => SetValue(ShowTitleProperty, value);
set => SetValue(ShowTitleProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowCancelProperty = DependencyProperty.Register(
@@ -118,7 +118,7 @@ namespace HandyControl.Controls
public bool ShowCancel
{
get => (bool)GetValue(ShowCancelProperty);
set => SetValue(ShowCancelProperty, value);
set => SetValue(ShowCancelProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowBorderProperty = DependencyProperty.Register(
@@ -127,7 +127,7 @@ namespace HandyControl.Controls
public bool ShowBorder
{
get => (bool) GetValue(ShowBorderProperty);
set => SetValue(ShowBorderProperty, value);
set => SetValue(ShowBorderProperty, ValueBoxes.BooleanBox(value));
}
private void TitleBlock_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@@ -208,7 +208,7 @@ namespace HandyControl.Controls
public bool IsFullScreen
{
get => (bool)GetValue(IsFullScreenProperty);
set => SetValue(IsFullScreenProperty, value);
set => SetValue(IsFullScreenProperty, ValueBoxes.BooleanBox(value));
}
public object NonClientAreaContent
@@ -256,13 +256,13 @@ namespace HandyControl.Controls
public bool ShowNonClientArea
{
get => (bool)GetValue(ShowNonClientAreaProperty);
set => SetValue(ShowNonClientAreaProperty, value);
set => SetValue(ShowNonClientAreaProperty, ValueBoxes.BooleanBox(value));
}
public bool ShowTitle
{
get => (bool)GetValue(ShowTitleProperty);
set => SetValue(ShowTitleProperty, value);
set => SetValue(ShowTitleProperty, ValueBoxes.BooleanBox(value));
}
private static void OnShowNonClientAreaChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -79,7 +79,7 @@ namespace HandyControl.Interactivity
{
get =>
(bool) GetValue(FloatAboveProperty);
set => SetValue(FloatAboveProperty, value);
set => SetValue(FloatAboveProperty, ValueBoxes.BooleanBox(value));
}
public TagType InitialTag
@@ -283,7 +283,7 @@ namespace HandyControl.Interactivity
private static void SetHasTransformWrapper(DependencyObject obj, bool value)
{
obj.SetValue(HasTransformWrapperProperty, value);
obj.SetValue(HasTransformWrapperProperty, ValueBoxes.BooleanBox(value));
}
private static void SetOverlay(DependencyObject obj, object value)
@@ -46,7 +46,7 @@ namespace HandyControl.Interactivity
{
get =>
(bool) GetValue(IsActiveProperty);
set => SetValue(IsActiveProperty, value);
set => SetValue(IsActiveProperty, ValueBoxes.BooleanBox(value));
}
protected virtual bool ShouldSkipInitialLayout =>
@@ -27,9 +27,8 @@ namespace HandyControl.Interactivity
public bool ConstrainToParentBounds
{
get =>
(bool) GetValue(ConstrainToParentBoundsProperty);
set => SetValue(ConstrainToParentBoundsProperty, value);
get => (bool) GetValue(ConstrainToParentBoundsProperty);
set => SetValue(ConstrainToParentBoundsProperty, ValueBoxes.BooleanBox(value));
}
private Rect ElementBounds
@@ -50,7 +50,7 @@ namespace HandyControl.Interactivity
public bool ConstrainToParentBounds
{
get => (bool)GetValue(MouseDragElementBehavior.ConstrainToParentBoundsProperty);
set => SetValue(MouseDragElementBehavior.ConstrainToParentBoundsProperty, value);
set => SetValue(MouseDragElementBehavior.ConstrainToParentBoundsProperty, ValueBoxes.BooleanBox(value));
}
private Rect ElementBounds
@@ -96,7 +96,7 @@ namespace HandyControl.Interactivity
public bool MustToggleIsEnabled
{
get => (bool) GetValue(MustToggleIsEnabledProperty);
set => SetValue(MustToggleIsEnabledProperty, value);
set => SetValue(MustToggleIsEnabledProperty, ValueBoxes.BooleanBox(value));
}
public bool MustToggleIsEnabledValue
@@ -127,7 +127,7 @@ namespace HandyControl.Interactivity
public bool AlwaysInvokeCommand
{
get => (bool) GetValue(AlwaysInvokeCommandProperty);
set => SetValue(AlwaysInvokeCommandProperty, value);
set => SetValue(AlwaysInvokeCommandProperty, ValueBoxes.BooleanBox(value));
}
protected override void OnAttached()
@@ -879,7 +879,7 @@ namespace HandyControl.Interactivity
internal static void SetDidCacheBackground(DependencyObject obj, bool value)
{
obj.SetValue(DidCacheBackgroundProperty, value);
obj.SetValue(DidCacheBackgroundProperty, ValueBoxes.BooleanBox(value));
}
internal static void SetLayoutStoryboard(DependencyObject obj, Storyboard value)
@@ -937,7 +937,7 @@ namespace HandyControl.Interactivity
public static void SetUseFluidLayout(DependencyObject obj, bool value)
{
obj.SetValue(UseFluidLayoutProperty, value);
obj.SetValue(UseFluidLayoutProperty, ValueBoxes.BooleanBox(value));
}
private static void StopAnimations()
@@ -3,6 +3,7 @@ using System.Globalization;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media.Animation;
using HandyControl.Data;
namespace HandyControl.Interactivity
{
@@ -43,9 +44,8 @@ namespace HandyControl.Interactivity
public bool IsEnabled
{
get =>
(bool) GetValue(IsEnabledProperty);
set => SetValue(IsEnabledProperty, value);
get => (bool) GetValue(IsEnabledProperty);
set => SetValue(IsEnabledProperty, ValueBoxes.BooleanBox(value));
}
internal bool IsHosted