add NumericUpDownPlus style
now you can clear, verify the value of NumericUpDown
This commit is contained in:
1 parent
53bfd7da17
commit
0b80e7ddec
36 files changed
+602
-76
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace HandyControl.Controls
|
namespace HandyControl.Controls
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace HandyControl.Controls
|
namespace HandyControl.Controls
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
using HandyControl.Data.Enum;
|
|
||||||
using HandyControl.Interactivity;
|
using HandyControl.Interactivity;
|
||||||
using HandyControl.Tools;
|
using HandyControl.Tools;
|
||||||
using HandyControl.Tools.Extension;
|
using HandyControl.Tools.Extension;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using HandyControl.Data;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表示可以成为一个数据输入控件
|
||||||
|
/// </summary>
|
||||||
|
public interface IDataInput
|
||||||
|
{
|
||||||
|
bool VerifyData();
|
||||||
|
|
||||||
|
Func<string, OperationResult<bool>> VerifyFunc { get; set; }
|
||||||
|
|
||||||
|
bool IsError { get; set; }
|
||||||
|
|
||||||
|
string ErrorStr { get; set; }
|
||||||
|
|
||||||
|
TextType TextType { get; set; }
|
||||||
|
|
||||||
|
bool ShowClearButton { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
public class TextBox : System.Windows.Controls.TextBox
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ namespace HandyControl.Controls
|
|||||||
/// 数值选择控件
|
/// 数值选择控件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TemplatePart(Name = ElementTextBox, Type = typeof(TextBox))]
|
[TemplatePart(Name = ElementTextBox, Type = typeof(TextBox))]
|
||||||
public class NumericUpDown : Control
|
public class NumericUpDown : Control, IDataInput
|
||||||
{
|
{
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
@@ -27,8 +27,23 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
public NumericUpDown()
|
public NumericUpDown()
|
||||||
{
|
{
|
||||||
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) => Value += Increment));
|
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) =>
|
||||||
CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) => Value -= Increment));
|
{
|
||||||
|
Value += Increment;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
|
_textBox.Select(_textBox.Text.Length, 0);
|
||||||
|
}));
|
||||||
|
CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) =>
|
||||||
|
{
|
||||||
|
Value -= Increment;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
|
_textBox.Select(_textBox.Text.Length, 0);
|
||||||
|
}));
|
||||||
|
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) =>
|
||||||
|
{
|
||||||
|
ClearValue(ValueProperty);
|
||||||
|
_textBox.Text = string.Empty;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnGotFocus(RoutedEventArgs e)
|
protected override void OnGotFocus(RoutedEventArgs e)
|
||||||
@@ -48,6 +63,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
_textBox.TextChanged -= TextBox_TextChanged;
|
_textBox.TextChanged -= TextBox_TextChanged;
|
||||||
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
|
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
|
||||||
|
_textBox.LostFocus -= TextBox_LostFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnApplyTemplate();
|
base.OnApplyTemplate();
|
||||||
@@ -58,34 +74,38 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
_textBox.TextChanged += TextBox_TextChanged;
|
_textBox.TextChanged += TextBox_TextChanged;
|
||||||
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
|
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
|
||||||
|
_textBox.LostFocus += TextBox_LostFocus;
|
||||||
_textBox.Text = CurrentText;
|
_textBox.Text = CurrentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (IsError) return;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
|
}
|
||||||
|
|
||||||
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Up)
|
if (e.Key == Key.Up)
|
||||||
{
|
{
|
||||||
Value += Increment;
|
Value += Increment;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
}
|
}
|
||||||
else if (e.Key == Key.Down)
|
else if (e.Key == Key.Down)
|
||||||
{
|
{
|
||||||
Value -= Increment;
|
Value -= Increment;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_textBox.Text)) return;
|
if (!VerifyData()) return;
|
||||||
if (double.TryParse(_textBox.Text, out var value))
|
if (double.TryParse(_textBox.Text, out var value))
|
||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_textBox != null)
|
|
||||||
{
|
|
||||||
_textBox.Text = CurrentText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||||
@@ -95,6 +115,8 @@ namespace HandyControl.Controls
|
|||||||
if (_textBox.IsFocused)
|
if (_textBox.IsFocused)
|
||||||
{
|
{
|
||||||
Value += e.Delta > 0 ? Increment : -Increment;
|
Value += e.Delta > 0 ? Increment : -Increment;
|
||||||
|
_textBox.Text = CurrentText;
|
||||||
|
_textBox.Select(_textBox.Text.Length, 0);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,13 +154,6 @@ namespace HandyControl.Controls
|
|||||||
var ctl = (NumericUpDown) d;
|
var ctl = (NumericUpDown) d;
|
||||||
var v = (double) e.NewValue;
|
var v = (double) e.NewValue;
|
||||||
|
|
||||||
if (ctl._textBox != null)
|
|
||||||
{
|
|
||||||
ctl._textBox.Text = ctl.DecimalPlaces.HasValue
|
|
||||||
? v.ToString($"#0.{new string('0', ctl.DecimalPlaces.Value)}")
|
|
||||||
: v.ToString("#0");
|
|
||||||
}
|
|
||||||
|
|
||||||
ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl)
|
ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl)
|
||||||
{
|
{
|
||||||
Info = v
|
Info = v
|
||||||
@@ -273,13 +288,131 @@ namespace HandyControl.Controls
|
|||||||
set => SetValue(DecimalPlacesProperty, value);
|
set => SetValue(DecimalPlacesProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示上下调值按钮
|
||||||
|
/// </summary>
|
||||||
internal static readonly DependencyProperty ShowUpDownButtonProperty = DependencyProperty.Register(
|
internal static readonly DependencyProperty ShowUpDownButtonProperty = DependencyProperty.Register(
|
||||||
"ShowUpDownButton", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(true));
|
"ShowUpDownButton", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(true));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示上下调值按钮
|
||||||
|
/// </summary>
|
||||||
internal bool ShowUpDownButton
|
internal bool ShowUpDownButton
|
||||||
{
|
{
|
||||||
get => (bool) GetValue(ShowUpDownButtonProperty);
|
get => (bool) GetValue(ShowUpDownButtonProperty);
|
||||||
set => SetValue(ShowUpDownButtonProperty, value);
|
set => SetValue(ShowUpDownButtonProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据是否错误
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register(
|
||||||
|
"IsError", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(default(bool)));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据是否错误
|
||||||
|
/// </summary>
|
||||||
|
public bool IsError
|
||||||
|
{
|
||||||
|
get => (bool) GetValue(IsErrorProperty);
|
||||||
|
set => SetValue(IsErrorProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误提示
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
|
||||||
|
"ErrorStr", typeof(string), typeof(NumericUpDown), new PropertyMetadata(default(string)));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误提示
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorStr
|
||||||
|
{
|
||||||
|
get => (string) GetValue(ErrorStrProperty);
|
||||||
|
set => SetValue(ErrorStrProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文本类型
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty TextTypeProperty = DependencyProperty.Register(
|
||||||
|
"TextType", typeof(TextType), typeof(NumericUpDown), new PropertyMetadata(default(TextType)));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文本类型
|
||||||
|
/// </summary>
|
||||||
|
public TextType TextType
|
||||||
|
{
|
||||||
|
get => (TextType) GetValue(TextTypeProperty);
|
||||||
|
set => SetValue(TextTypeProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示清除按钮
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ShowClearButtonProperty = DependencyProperty.Register(
|
||||||
|
"ShowClearButton", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(default(bool)));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示清除按钮
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowClearButton
|
||||||
|
{
|
||||||
|
get => (bool) GetValue(ShowClearButtonProperty);
|
||||||
|
set => SetValue(ShowClearButtonProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据验证委托
|
||||||
|
/// </summary>
|
||||||
|
public Func<string, OperationResult<bool>> VerifyFunc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool VerifyData()
|
||||||
|
{
|
||||||
|
OperationResult<bool> result;
|
||||||
|
|
||||||
|
if (VerifyFunc != null)
|
||||||
|
{
|
||||||
|
result = VerifyFunc.Invoke(_textBox.Text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(_textBox.Text))
|
||||||
|
{
|
||||||
|
if (double.TryParse(_textBox.Text, out var value))
|
||||||
|
{
|
||||||
|
if (value < Minimum || value > Maximum)
|
||||||
|
{
|
||||||
|
result = OperationResult.Failed(Properties.Langs.Lang.OutOfRange);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = OperationResult.Success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = OperationResult.Failed(Properties.Langs.Lang.FormatError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (InfoElement.GetNecessary(this))
|
||||||
|
{
|
||||||
|
result = OperationResult.Failed(Properties.Langs.Lang.IsNecessary);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = OperationResult.Success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsError = !result.Data;
|
||||||
|
ErrorStr = result.Message;
|
||||||
|
return result.Data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
public enum InfoType
|
public enum InfoType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IP类型枚举
|
/// IP类型枚举
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表示一个操作的返回结果类型
|
||||||
|
/// </summary>
|
||||||
|
public enum ResultType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 成功
|
||||||
|
/// </summary>
|
||||||
|
Success,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 失败
|
||||||
|
/// </summary>
|
||||||
|
Failed,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 无数据
|
||||||
|
/// </summary>
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
public enum SkinType
|
public enum SkinType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文本类型枚举
|
/// 文本类型枚举
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum TextType
|
public enum TextType
|
||||||
{
|
{
|
||||||
Common = 0,
|
Common,
|
||||||
Phone,
|
Phone,
|
||||||
Mail,
|
Mail,
|
||||||
Url,
|
Url,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
public enum TipPlacement
|
public enum TipPlacement
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace HandyControl.Data.Enum
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标题对齐方式
|
/// 标题对齐方式
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControl.Data
|
namespace HandyControl.Data
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace HandyControl.Data
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表示一个操作的返回结果信息
|
||||||
|
/// </summary>
|
||||||
|
public class OperationResult<T> : OperationResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作结果
|
||||||
|
/// </summary>
|
||||||
|
public ResultType ResultType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回数据
|
||||||
|
/// </summary>
|
||||||
|
public T Data { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作消息(包含错误原因等数据)
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
namespace HandyControl.Data
|
||||||
|
{
|
||||||
|
public class OperationResult
|
||||||
|
{
|
||||||
|
public static OperationResult<bool> Failed(string message = "")
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>
|
||||||
|
{
|
||||||
|
ResultType = ResultType.Failed,
|
||||||
|
Message = message,
|
||||||
|
Data = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OperationResult<bool> Success(string message = "")
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>
|
||||||
|
{
|
||||||
|
ResultType = ResultType.Success,
|
||||||
|
Message = message,
|
||||||
|
Data = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,9 @@ namespace HandyControl.Expression.Media
|
|||||||
{
|
{
|
||||||
internal class DrawingPropertyMetadata : FrameworkPropertyMetadata
|
internal class DrawingPropertyMetadata : FrameworkPropertyMetadata
|
||||||
{
|
{
|
||||||
|
#pragma warning disable 414
|
||||||
private DrawingPropertyMetadataOptions options;
|
private DrawingPropertyMetadataOptions options;
|
||||||
|
#pragma warning restore 414
|
||||||
|
|
||||||
private PropertyChangedCallback propertyChangedCallback;
|
private PropertyChangedCallback propertyChangedCallback;
|
||||||
|
|
||||||
@@ -14,8 +16,7 @@ namespace HandyControl.Expression.Media
|
|||||||
static DrawingPropertyMetadata()
|
static DrawingPropertyMetadata()
|
||||||
{
|
{
|
||||||
DrawingPropertyChanged += delegate (object sender, DrawingPropertyChangedEventArgs args) {
|
DrawingPropertyChanged += delegate (object sender, DrawingPropertyChangedEventArgs args) {
|
||||||
IShape shape = sender as IShape;
|
if ((sender is IShape shape) && args.Metadata.AffectsRender)
|
||||||
if ((shape != null) && args.Metadata.AffectsRender)
|
|
||||||
{
|
{
|
||||||
InvalidateGeometryReasons reasons = InvalidateGeometryReasons.PropertyChanged;
|
InvalidateGeometryReasons reasons = InvalidateGeometryReasons.PropertyChanged;
|
||||||
if (args.IsAnimated)
|
if (args.IsAnimated)
|
||||||
@@ -54,7 +55,7 @@ namespace HandyControl.Expression.Media
|
|||||||
options = options,
|
options = options,
|
||||||
propertyChangedCallback = propertyChangedCallback
|
propertyChangedCallback = propertyChangedCallback
|
||||||
};
|
};
|
||||||
return new PropertyChangedCallback(metadata.InternalCallback);
|
return metadata.InternalCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InternalCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
private void InternalCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||||
@@ -68,10 +69,8 @@ namespace HandyControl.Expression.Media
|
|||||||
};
|
};
|
||||||
DrawingPropertyChanged(sender, args);
|
DrawingPropertyChanged(sender, args);
|
||||||
}
|
}
|
||||||
if (this.propertyChangedCallback != null)
|
|
||||||
{
|
propertyChangedCallback?.Invoke(sender, e);
|
||||||
this.propertyChangedCallback(sender, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,8 @@
|
|||||||
<Compile Include="Controls\Clock\Clock.cs" />
|
<Compile Include="Controls\Clock\Clock.cs" />
|
||||||
<Compile Include="Controls\Clock\ClockRadioButton.cs" />
|
<Compile Include="Controls\Clock\ClockRadioButton.cs" />
|
||||||
<Compile Include="Controls\Growl.cs" />
|
<Compile Include="Controls\Growl.cs" />
|
||||||
|
<Compile Include="Controls\IDataInput.cs" />
|
||||||
|
<Compile Include="Controls\Input\TextBox.cs" />
|
||||||
<Compile Include="Controls\ISingleOpen.cs" />
|
<Compile Include="Controls\ISingleOpen.cs" />
|
||||||
<Compile Include="Controls\NumericUpDown.cs" />
|
<Compile Include="Controls\NumericUpDown.cs" />
|
||||||
<Compile Include="Controls\Pagination.cs" />
|
<Compile Include="Controls\Pagination.cs" />
|
||||||
@@ -64,9 +66,12 @@
|
|||||||
<Compile Include="Controls\Loading\LoadingLine.cs" />
|
<Compile Include="Controls\Loading\LoadingLine.cs" />
|
||||||
<Compile Include="Controls\InternalCanvas.cs" />
|
<Compile Include="Controls\InternalCanvas.cs" />
|
||||||
<Compile Include="Data\Enum\InfoType.cs" />
|
<Compile Include="Data\Enum\InfoType.cs" />
|
||||||
|
<Compile Include="Data\Enum\ResultType.cs" />
|
||||||
<Compile Include="Data\Enum\SkinType.cs" />
|
<Compile Include="Data\Enum\SkinType.cs" />
|
||||||
<Compile Include="Data\Enum\TipPlacement.cs" />
|
<Compile Include="Data\Enum\TipPlacement.cs" />
|
||||||
<Compile Include="Data\GrowlInfo.cs" />
|
<Compile Include="Data\GrowlInfo.cs" />
|
||||||
|
<Compile Include="Data\OperationResult!1.cs" />
|
||||||
|
<Compile Include="Data\OperationResult.cs" />
|
||||||
<Compile Include="Data\ResourceToken.cs">
|
<Compile Include="Data\ResourceToken.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|||||||
@@ -7,119 +7,124 @@ namespace HandyControl.Interactivity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ControlCommands
|
public static class ControlCommands
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 清除
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedCommand Clear { get; } = new RoutedCommand(nameof(Clear), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 切换
|
/// 切换
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Switch { get; } = new RoutedCommand("Switch", typeof(ControlCommands));
|
public static RoutedCommand Switch { get; } = new RoutedCommand(nameof(Switch), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 右转
|
/// 右转
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand RotateRight { get; } = new RoutedCommand("RotateRight", typeof(ControlCommands));
|
public static RoutedCommand RotateRight { get; } = new RoutedCommand(nameof(RotateRight), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 左转
|
/// 左转
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand RotateLeft { get; } = new RoutedCommand("RotateLeft", typeof(ControlCommands));
|
public static RoutedCommand RotateLeft { get; } = new RoutedCommand(nameof(RotateLeft), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 小
|
/// 小
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Reduce { get; } = new RoutedCommand("Reduce", typeof(ControlCommands));
|
public static RoutedCommand Reduce { get; } = new RoutedCommand(nameof(Reduce), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 大
|
/// 大
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Enlarge { get; } = new RoutedCommand("Enlarge", typeof(ControlCommands));
|
public static RoutedCommand Enlarge { get; } = new RoutedCommand(nameof(Enlarge), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 还原
|
/// 还原
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Restore { get; } = new RoutedCommand("Restore", typeof(ControlCommands));
|
public static RoutedCommand Restore { get; } = new RoutedCommand(nameof(Restore), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打开
|
/// 打开
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Open { get; } = new RoutedCommand("Open", typeof(ControlCommands));
|
public static RoutedCommand Open { get; } = new RoutedCommand(nameof(Open), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存
|
/// 保存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Save { get; } = new RoutedCommand("Save", typeof(ControlCommands));
|
public static RoutedCommand Save { get; } = new RoutedCommand(nameof(Save), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选中
|
/// 选中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Selected { get; } = new RoutedCommand("Selected", typeof(ControlCommands));
|
public static RoutedCommand Selected { get; } = new RoutedCommand(nameof(Selected), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关闭
|
/// 关闭
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Close { get; } = new RoutedCommand("Close", typeof(ControlCommands));
|
public static RoutedCommand Close { get; } = new RoutedCommand(nameof(Close), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取消
|
/// 取消
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Cancel { get; } = new RoutedCommand("Cancel", typeof(ControlCommands));
|
public static RoutedCommand Cancel { get; } = new RoutedCommand(nameof(Cancel), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 确定
|
/// 确定
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Confirm { get; } = new RoutedCommand("Confirm", typeof(ControlCommands));
|
public static RoutedCommand Confirm { get; } = new RoutedCommand(nameof(Confirm), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关闭所有
|
/// 关闭所有
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand CloseAll { get; } = new RoutedCommand("CloseAll", typeof(ControlCommands));
|
public static RoutedCommand CloseAll { get; } = new RoutedCommand(nameof(CloseAll), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关闭其他
|
/// 关闭其他
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand CloseOther { get; } = new RoutedCommand("CloseOther", typeof(ControlCommands));
|
public static RoutedCommand CloseOther { get; } = new RoutedCommand(nameof(CloseOther), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上一个
|
/// 上一个
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Prev { get; } = new RoutedCommand("Prev", typeof(ControlCommands));
|
public static RoutedCommand Prev { get; } = new RoutedCommand(nameof(Prev), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下一个
|
/// 下一个
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Next { get; } = new RoutedCommand("Next", typeof(ControlCommands));
|
public static RoutedCommand Next { get; } = new RoutedCommand(nameof(Next), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上午
|
/// 上午
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Am { get; } = new RoutedCommand("Am", typeof(ControlCommands));
|
public static RoutedCommand Am { get; } = new RoutedCommand(nameof(Am), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下午
|
/// 下午
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Pm { get; } = new RoutedCommand("Pm", typeof(ControlCommands));
|
public static RoutedCommand Pm { get; } = new RoutedCommand(nameof(Pm), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 确认
|
/// 确认
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand Sure { get; } = new RoutedCommand("Sure", typeof(ControlCommands));
|
public static RoutedCommand Sure { get; } = new RoutedCommand(nameof(Sure), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 小时改变
|
/// 小时改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand HourChange { get; } = new RoutedCommand("HourChange", typeof(ControlCommands));
|
public static RoutedCommand HourChange { get; } = new RoutedCommand(nameof(HourChange), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分钟改变
|
/// 分钟改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand MinuteChange { get; } = new RoutedCommand("MinuteChange", typeof(ControlCommands));
|
public static RoutedCommand MinuteChange { get; } = new RoutedCommand(nameof(MinuteChange), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 秒改变
|
/// 秒改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand SecondChange { get; } = new RoutedCommand("SecondChange", typeof(ControlCommands));
|
public static RoutedCommand SecondChange { get; } = new RoutedCommand(nameof(SecondChange), typeof(ControlCommands));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 鼠标移动
|
/// 鼠标移动
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RoutedCommand MouseMove { get; } = new RoutedCommand("MouseMove", typeof(ControlCommands));
|
public static RoutedCommand MouseMove { get; } = new RoutedCommand(nameof(MouseMove), typeof(ControlCommands));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+28
-1
@@ -47,7 +47,7 @@ namespace HandyControl.Properties.Langs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用此强类型资源类,为所有资源查找
|
/// 重写当前线程的 CurrentUICulture 属性
|
||||||
/// 重写当前线程的 CurrentUICulture 属性。
|
/// 重写当前线程的 CurrentUICulture 属性。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
@@ -141,6 +141,15 @@ namespace HandyControl.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 格式错误 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string FormatError {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("FormatError", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 间隔10分钟 的本地化字符串。
|
/// 查找类似 间隔10分钟 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -204,6 +213,24 @@ namespace HandyControl.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 不能为空 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string IsNecessary {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("IsNecessary", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 不在范围内 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string OutOfRange {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("OutOfRange", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 下午 的本地化字符串。
|
/// 查找类似 下午 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -186,4 +186,13 @@
|
|||||||
<data name="Tip" xml:space="preserve">
|
<data name="Tip" xml:space="preserve">
|
||||||
<value>Prompt</value>
|
<value>Prompt</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="IsNecessary" xml:space="preserve">
|
||||||
|
<value>cannot be empty</value>
|
||||||
|
</data>
|
||||||
|
<data name="OutOfRange" xml:space="preserve">
|
||||||
|
<value>out of range</value>
|
||||||
|
</data>
|
||||||
|
<data name="FormatError" xml:space="preserve">
|
||||||
|
<value>format error</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -166,4 +166,13 @@
|
|||||||
<data name="Tip" xml:space="preserve">
|
<data name="Tip" xml:space="preserve">
|
||||||
<value>提示</value>
|
<value>提示</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="IsNecessary" xml:space="preserve">
|
||||||
|
<value>不能为空</value>
|
||||||
|
</data>
|
||||||
|
<data name="OutOfRange" xml:space="preserve">
|
||||||
|
<value>不在范围内</value>
|
||||||
|
</data>
|
||||||
|
<data name="FormatError" xml:space="preserve">
|
||||||
|
<value>格式错误</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -93,4 +93,138 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="NumericUpDownPlusTopTemplate" TargetType="controls:NumericUpDown">
|
||||||
|
<ControlTemplate.Resources>
|
||||||
|
<Storyboard x:Key="StoryboardShow">
|
||||||
|
<ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="7,0,0,-18" Duration="0:0:.2"/>
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="StoryboardHidden">
|
||||||
|
<ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="7,0,0,4" Duration="0:0:0"/>
|
||||||
|
</Storyboard>
|
||||||
|
</ControlTemplate.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="{TemplateBinding ErrorStr}" Name="TextBlockError" VerticalAlignment="Bottom" Margin="7,0,0,4" Foreground="{DynamicResource DangerBrush}" Grid.Row="1"/>
|
||||||
|
<StackPanel Grid.Row="0" Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" Margin="7,4">
|
||||||
|
<TextBlock Foreground="{TemplateBinding Foreground}" Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Border Grid.Row="1" x:Name="templateRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||||
|
<Grid SnapsToDevicePixels="true">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="25"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<controls:WatermarkTextBox CaretBrush="{TemplateBinding Foreground}" x:Name="PART_TextBox" Padding="5,6" Margin="0,0,0,1" Watermark="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Stretch" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
<Button Command="interactivity:ControlCommands.Clear" Name="ButtonClear" Width="16" Visibility="Collapsed" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=templateRoot}"/>
|
||||||
|
<Button Command="interactivity:ControlCommands.Prev" Padding="0,7,5,1" Margin="0,0,0,16" Focusable="False" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=templateRoot}" controls:IconElement.Geometry="{StaticResource UpGeometry}" Style="{StaticResource ButtonIcon}" Width="30" VerticalAlignment="Center" Height="14"/>
|
||||||
|
<Button Command="interactivity:ControlCommands.Next" Padding="0,1,5,7" Margin="0,16,0,0" Focusable="False" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=templateRoot}" controls:IconElement.Geometry="{StaticResource DownGeometry}" Style="{StaticResource ButtonIcon}" Width="30" VerticalAlignment="Center" Height="14"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" TargetName="templateRoot" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="templateRoot">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsMouseOver" Value="true"/>
|
||||||
|
<Condition Property="ShowClearButton" Value="True"/>
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="ButtonClear"/>
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
|
||||||
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsError" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource DangerBrush}"/>
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource StoryboardShow}"/>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource StoryboardHidden}"/>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="NumericUpDownPlusLeftTemplate" TargetType="controls:NumericUpDown">
|
||||||
|
<ControlTemplate.Resources>
|
||||||
|
<Storyboard x:Key="StoryboardShow">
|
||||||
|
<ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="7,0,0,-18" Duration="0:0:.2"/>
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="StoryboardHidden">
|
||||||
|
<ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="7,0,0,4" Duration="0:0:0"/>
|
||||||
|
</Storyboard>
|
||||||
|
</ControlTemplate.Resources>
|
||||||
|
<Grid Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="{Binding Path=(controls:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="{TemplateBinding ErrorStr}" Name="TextBlockError" VerticalAlignment="Bottom" Margin="7,0,0,4" Foreground="{DynamicResource DangerBrush}" Grid.Column="1"/>
|
||||||
|
<StackPanel Grid.Column="0" Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0,7,6,8">
|
||||||
|
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Border Grid.Column="1" x:Name="templateRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||||
|
<Grid x:Name="PART_Root" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="25"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<controls:WatermarkTextBox CaretBrush="{TemplateBinding Foreground}" x:Name="PART_TextBox" Padding="5,6" Margin="0,0,0,1" Watermark="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Stretch" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
<Button Command="interactivity:ControlCommands.Clear" Name="PART_ButtonClear" Width="16" Visibility="Collapsed" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=templateRoot}"/>
|
||||||
|
<Button Visibility="{TemplateBinding ShowUpDownButton,Converter={StaticResource Boolean2VisibilityConverter}}" Command="interactivity:ControlCommands.Prev" Padding="0,7,5,1" Margin="0,0,0,16" Focusable="False" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=templateRoot}" controls:IconElement.Geometry="{StaticResource UpGeometry}" Style="{StaticResource ButtonIcon}" Width="30" VerticalAlignment="Center" Height="14"/>
|
||||||
|
<Button Visibility="{TemplateBinding ShowUpDownButton,Converter={StaticResource Boolean2VisibilityConverter}}" Command="interactivity:ControlCommands.Next" Padding="0,1,5,7" Margin="0,16,0,0" Focusable="False" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=templateRoot}" controls:IconElement.Geometry="{StaticResource DownGeometry}" Style="{StaticResource ButtonIcon}" Width="30" VerticalAlignment="Center" Height="14"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" TargetName="templateRoot" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="templateRoot">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsMouseOver" Value="true"/>
|
||||||
|
<Condition Property="ShowClearButton" Value="True"/>
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="PART_ButtonClear"/>
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
|
||||||
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsError" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource DangerBrush}"/>
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource StoryboardShow}"/>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource StoryboardHidden}"/>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<Style x:Key="NumericUpDownPlus" BasedOn="{StaticResource NumericUpDownExtend}" TargetType="controls:NumericUpDown">
|
||||||
|
<Setter Property="Template" Value="{StaticResource NumericUpDownPlusTopTemplate}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||||
|
<Setter Property="Template" Value="{StaticResource NumericUpDownPlusLeftTemplate}"/>
|
||||||
|
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -79,4 +79,68 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="TextBoxPlusTopTemplate" TargetType="controls:TextBox">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" Margin="7,4">
|
||||||
|
<TextBlock Foreground="{DynamicResource PrimaryTextBrush}" Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Border x:Name="border" Grid.Row="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
|
||||||
|
<TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="8" Grid.Row="1" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ScrollViewer Padding="7,0" Margin="1,1,1,2" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Row="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" TargetName="border" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="PART_ContentHost">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsFocused" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="TextBoxPlusLeftTemplate" TargetType="controls:TextBox">
|
||||||
|
<Grid Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="{Binding Path=(controls:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0,7,6,8">
|
||||||
|
<TextBlock Foreground="{DynamicResource PrimaryTextBrush}" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Border x:Name="border" Grid.Column="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
|
||||||
|
<TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="8,7,8,8" Grid.Column="1" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<ScrollViewer Grid.Column="1" Padding="7,0" Margin="1,1,1,2" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" TargetName="border" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="PART_ContentHost">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsFocused" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<Style BasedOn="{StaticResource TextBoxExtend}" TargetType="controls:TextBox">
|
||||||
|
<Setter Property="Template" Value="{StaticResource TextBoxPlusTopTemplate}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||||
|
<Setter Property="Template" Value="{StaticResource TextBoxPlusLeftTemplate}"/>
|
||||||
|
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControl.Tools
|
namespace HandyControl.Tools
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControl.Tools
|
namespace HandyControl.Tools
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
using HandyControl.Tools;
|
using HandyControl.Tools;
|
||||||
using HandyControlDemo.Data;
|
using HandyControlDemo.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControlDemo.Data
|
namespace HandyControlDemo.Data
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-1
@@ -47,7 +47,7 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用此强类型资源类,为所有资源查找
|
/// 重写当前线程的 CurrentUICulture 属性
|
||||||
/// 重写当前线程的 CurrentUICulture 属性。
|
/// 重写当前线程的 CurrentUICulture 属性。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
@@ -456,6 +456,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 不是手机号码 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string IsNotPhone {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("IsNotPhone", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 列表框 的本地化字符串。
|
/// 查找类似 列表框 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -390,4 +390,7 @@
|
|||||||
<data name="CircleProgressBar" xml:space="preserve">
|
<data name="CircleProgressBar" xml:space="preserve">
|
||||||
<value>CircleProgressBar</value>
|
<value>CircleProgressBar</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="IsNotPhone" xml:space="preserve">
|
||||||
|
<value>It's not a phone number</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -370,4 +370,7 @@
|
|||||||
<data name="CircleProgressBar" xml:space="preserve">
|
<data name="CircleProgressBar" xml:space="preserve">
|
||||||
<value>圆形进度条</value>
|
<value>圆形进度条</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="IsNotPhone" xml:space="preserve">
|
||||||
|
<value>不是手机号码</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -5,15 +5,25 @@
|
|||||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
Background="{DynamicResource RegionBrush}">
|
Background="{DynamicResource RegionBrush}">
|
||||||
<controls:TransitioningContentControl>
|
<controls:TransitioningContentControl>
|
||||||
<StackPanel Margin="32">
|
<StackPanel Margin="32" Orientation="Horizontal">
|
||||||
<controls:NumericUpDown x:Name="NumericUpDown"/>
|
<StackPanel>
|
||||||
<controls:NumericUpDown Margin="0,16,0,0" IsEnabled="False"/>
|
<controls:NumericUpDown/>
|
||||||
|
<controls:NumericUpDown Margin="0,32,0,0" IsEnabled="False"/>
|
||||||
|
|
||||||
<controls:NumericUpDown controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" Style="{StaticResource NumericUpDownExtend}"/>
|
<controls:NumericUpDown controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" Style="{StaticResource NumericUpDownExtend}"/>
|
||||||
<controls:NumericUpDown controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,16,0,0" controls:InfoElement.Necessary="True" Style="{StaticResource NumericUpDownExtend}"/>
|
<controls:NumericUpDown controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" controls:InfoElement.Necessary="True" Style="{StaticResource NumericUpDownExtend}"/>
|
||||||
<controls:NumericUpDown Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownExtend}" Margin="0,32,0,0"/>
|
<controls:NumericUpDown Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownExtend}" Margin="0,32,0,0"/>
|
||||||
<controls:NumericUpDown Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownExtend}" controls:InfoElement.Necessary="True" Margin="0,16,0,0"/>
|
<controls:NumericUpDown Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownExtend}" controls:InfoElement.Necessary="True" Margin="0,32,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Margin="32,0,0,0">
|
||||||
|
<controls:NumericUpDown Name="NumericUpDownCustomVerify" ShowClearButton="True" Style="{StaticResource NumericUpDownPlus}"/>
|
||||||
|
<controls:NumericUpDown Margin="0,32,0,0" IsEnabled="False" Style="{StaticResource NumericUpDownPlus}"/>
|
||||||
|
|
||||||
|
<controls:NumericUpDown ShowClearButton="True" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" Style="{StaticResource NumericUpDownPlus}"/>
|
||||||
|
<controls:NumericUpDown controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" controls:InfoElement.Necessary="True" Style="{StaticResource NumericUpDownPlus}"/>
|
||||||
|
<controls:NumericUpDown Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownPlus}" Margin="0,32,0,0"/>
|
||||||
|
<controls:NumericUpDown DecimalPlaces="2" ShowClearButton="True" Width="380" controls:InfoElement.TitleWidth="140" controls:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" controls:InfoElement.TitleAlignment="Left" controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr3}" Style="{StaticResource NumericUpDownPlus}" controls:InfoElement.Necessary="True" Margin="0,32,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</controls:TransitioningContentControl>
|
</controls:TransitioningContentControl>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
// ReSharper disable once CheckNamespace
|
using HandyControl.Data;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
public partial class NumericUpDownDemoCtl
|
public partial class NumericUpDownDemoCtl
|
||||||
@@ -6,6 +8,12 @@ namespace HandyControlDemo.UserControl
|
|||||||
public NumericUpDownDemoCtl()
|
public NumericUpDownDemoCtl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
NumericUpDownCustomVerify.VerifyFunc = str => double.TryParse(str, out var v)
|
||||||
|
? v % 2 < 1e-06
|
||||||
|
? OperationResult.Failed(Properties.Langs.Lang.Error)
|
||||||
|
: OperationResult.Success()
|
||||||
|
: OperationResult.Failed(Properties.Langs.Lang.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.SliderDemoCtl}" Content="{x:Static langs:Lang.Slider}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.SliderDemoCtl}" Content="{x:Static langs:Lang.Slider}">
|
||||||
<controls:EdgeElement.LeftContent>
|
<controls:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/Slider_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/Slider_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="{x:Static langs:Lang.Controls}">
|
<TabItem Header="{x:Static langs:Lang.Controls}">
|
||||||
<ListBox BorderThickness="0" SelectionMode="Single">
|
<ListBox BorderThickness="0" SelectionMode="Single">
|
||||||
<ListBoxItem Tag="{x:Static data:MessageToken.NumericUpDownDemoCtl}" Content="{x:Static langs:Lang.NumericUpDown}">
|
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.NumericUpDownDemoCtl}" Content="{x:Static langs:Lang.NumericUpDown}">
|
||||||
<controls:EdgeElement.LeftContent>
|
<controls:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/NumericListBox_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/NumericListBox_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/ColorWheel_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ColorWheel_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.CircleProgressBarDemoCtl}" Content="{x:Static langs:Lang.CircleProgressBar}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.CircleProgressBarDemoCtl}" Content="{x:Static langs:Lang.CircleProgressBar}">
|
||||||
<controls:EdgeElement.LeftContent>
|
<controls:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/ShapeArcRing_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ShapeArcRing_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
Height="28"
|
Height="28"
|
||||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||||
xmlns:enum="clr-namespace:HandyControl.Data.Enum;assembly=HandyControl">
|
xmlns:enum="clr-namespace:HandyControl.Data;assembly=HandyControl">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using GalaSoft.MvvmLight.Messaging;
|
using GalaSoft.MvvmLight.Messaging;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using HandyControl.Data.Enum;
|
using HandyControl.Data;
|
||||||
using HandyControlDemo.Data;
|
using HandyControlDemo.Data;
|
||||||
using HandyControlDemo.Tools;
|
using HandyControlDemo.Tools;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user