add NumericUpDownPlus style

now you can clear, verify the value of NumericUpDown
This commit is contained in:
NaBian committed 2018-11-07 16:54:33 +08:00
1 parent 53bfd7da17
commit 0b80e7ddec
36 files changed
+602 -76

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
using System.Windows;
using HandyControl.Data.Enum;
using HandyControl.Data;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
+1 -1
View File
@@ -1,5 +1,5 @@
using System.Windows;
using HandyControl.Data.Enum;
using HandyControl.Data;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
-1
View File
@@ -7,7 +7,6 @@ using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using HandyControl.Data;
using HandyControl.Data.Enum;
using HandyControl.Interactivity;
using HandyControl.Tools;
using HandyControl.Tools.Extension;
+23
View File
@@ -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; }
}
}
+8
View File
@@ -0,0 +1,8 @@
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
public class TextBox : System.Windows.Controls.TextBox
{
}
}
+149 -16
View File
@@ -11,7 +11,7 @@ namespace HandyControl.Controls
/// 数值选择控件
/// </summary>
[TemplatePart(Name = ElementTextBox, Type = typeof(TextBox))]
public class NumericUpDown : Control
public class NumericUpDown : Control, IDataInput
{
#region Constants
@@ -27,8 +27,23 @@ namespace HandyControl.Controls
public NumericUpDown()
{
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) => Value += Increment));
CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) => Value -= Increment));
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) =>
{
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)
@@ -48,6 +63,7 @@ namespace HandyControl.Controls
{
_textBox.TextChanged -= TextBox_TextChanged;
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
_textBox.LostFocus -= TextBox_LostFocus;
}
base.OnApplyTemplate();
@@ -58,34 +74,38 @@ namespace HandyControl.Controls
{
_textBox.TextChanged += TextBox_TextChanged;
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
_textBox.LostFocus += TextBox_LostFocus;
_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)
{
if (e.Key == Key.Up)
{
Value += Increment;
_textBox.Text = CurrentText;
}
else if (e.Key == Key.Down)
{
Value -= Increment;
_textBox.Text = CurrentText;
}
}
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))
{
Value = value;
}
if (_textBox != null)
{
_textBox.Text = CurrentText;
}
}
protected override void OnMouseWheel(MouseWheelEventArgs e)
@@ -95,6 +115,8 @@ namespace HandyControl.Controls
if (_textBox.IsFocused)
{
Value += e.Delta > 0 ? Increment : -Increment;
_textBox.Text = CurrentText;
_textBox.Select(_textBox.Text.Length, 0);
e.Handled = true;
}
}
@@ -132,13 +154,6 @@ namespace HandyControl.Controls
var ctl = (NumericUpDown) d;
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)
{
Info = v
@@ -273,13 +288,131 @@ namespace HandyControl.Controls
set => SetValue(DecimalPlacesProperty, value);
}
/// <summary>
/// 是否显示上下调值按钮
/// </summary>
internal static readonly DependencyProperty ShowUpDownButtonProperty = DependencyProperty.Register(
"ShowUpDownButton", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(true));
/// <summary>
/// 是否显示上下调值按钮
/// </summary>
internal bool ShowUpDownButton
{
get => (bool) GetValue(ShowUpDownButtonProperty);
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;
}
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
public enum InfoType
{
+2 -1
View File
@@ -1,4 +1,5 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
/// <summary>
/// IP类型枚举
+24
View File
@@ -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
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
public enum SkinType
{
+3 -2
View File
@@ -1,11 +1,12 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
/// <summary>
/// 文本类型枚举
/// </summary>
public enum TextType
{
Common = 0,
Common,
Phone,
Mail,
Url,
+2 -1
View File
@@ -1,4 +1,5 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
public enum TipPlacement
{
+2 -1
View File
@@ -1,4 +1,5 @@
namespace HandyControl.Data.Enum
// ReSharper disable once CheckNamespace
namespace HandyControl.Data
{
/// <summary>
/// 标题对齐方式
+1 -1
View File
@@ -1,5 +1,5 @@
using System;
using HandyControl.Data.Enum;
using HandyControl.Data;
namespace HandyControl.Data
{
+23
View File
@@ -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; }
}
}
+25
View File
@@ -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
{
#pragma warning disable 414
private DrawingPropertyMetadataOptions options;
#pragma warning restore 414
private PropertyChangedCallback propertyChangedCallback;
@@ -14,8 +16,7 @@ namespace HandyControl.Expression.Media
static DrawingPropertyMetadata()
{
DrawingPropertyChanged += delegate (object sender, DrawingPropertyChangedEventArgs args) {
IShape shape = sender as IShape;
if ((shape != null) && args.Metadata.AffectsRender)
if ((sender is IShape shape) && args.Metadata.AffectsRender)
{
InvalidateGeometryReasons reasons = InvalidateGeometryReasons.PropertyChanged;
if (args.IsAnimated)
@@ -54,7 +55,7 @@ namespace HandyControl.Expression.Media
options = options,
propertyChangedCallback = propertyChangedCallback
};
return new PropertyChangedCallback(metadata.InternalCallback);
return metadata.InternalCallback;
}
private void InternalCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
@@ -68,10 +69,8 @@ namespace HandyControl.Expression.Media
};
DrawingPropertyChanged(sender, args);
}
if (this.propertyChangedCallback != null)
{
this.propertyChangedCallback(sender, e);
}
propertyChangedCallback?.Invoke(sender, e);
}
}
}
+5
View File
@@ -51,6 +51,8 @@
<Compile Include="Controls\Clock\Clock.cs" />
<Compile Include="Controls\Clock\ClockRadioButton.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\NumericUpDown.cs" />
<Compile Include="Controls\Pagination.cs" />
@@ -64,9 +66,12 @@
<Compile Include="Controls\Loading\LoadingLine.cs" />
<Compile Include="Controls\InternalCanvas.cs" />
<Compile Include="Data\Enum\InfoType.cs" />
<Compile Include="Data\Enum\ResultType.cs" />
<Compile Include="Data\Enum\SkinType.cs" />
<Compile Include="Data\Enum\TipPlacement.cs" />
<Compile Include="Data\GrowlInfo.cs" />
<Compile Include="Data\OperationResult!1.cs" />
<Compile Include="Data\OperationResult.cs" />
<Compile Include="Data\ResourceToken.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
+28 -23
View File
@@ -7,119 +7,124 @@ namespace HandyControl.Interactivity
/// </summary>
public static class ControlCommands
{
/// <summary>
/// 清除
/// </summary>
public static RoutedCommand Clear { get; } = new RoutedCommand(nameof(Clear), typeof(ControlCommands));
/// <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>
public static RoutedCommand RotateRight { get; } = new RoutedCommand("RotateRight", typeof(ControlCommands));
public static RoutedCommand RotateRight { get; } = new RoutedCommand(nameof(RotateRight), typeof(ControlCommands));
/// <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>
public static RoutedCommand Reduce { get; } = new RoutedCommand("Reduce", typeof(ControlCommands));
public static RoutedCommand Reduce { get; } = new RoutedCommand(nameof(Reduce), typeof(ControlCommands));
/// <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>
public static RoutedCommand Restore { get; } = new RoutedCommand("Restore", typeof(ControlCommands));
public static RoutedCommand Restore { get; } = new RoutedCommand(nameof(Restore), typeof(ControlCommands));
/// <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>
public static RoutedCommand Save { get; } = new RoutedCommand("Save", typeof(ControlCommands));
public static RoutedCommand Save { get; } = new RoutedCommand(nameof(Save), typeof(ControlCommands));
/// <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>
public static RoutedCommand Close { get; } = new RoutedCommand("Close", typeof(ControlCommands));
public static RoutedCommand Close { get; } = new RoutedCommand(nameof(Close), typeof(ControlCommands));
/// <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>
public static RoutedCommand Confirm { get; } = new RoutedCommand("Confirm", typeof(ControlCommands));
public static RoutedCommand Confirm { get; } = new RoutedCommand(nameof(Confirm), typeof(ControlCommands));
/// <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>
public static RoutedCommand CloseOther { get; } = new RoutedCommand("CloseOther", typeof(ControlCommands));
public static RoutedCommand CloseOther { get; } = new RoutedCommand(nameof(CloseOther), typeof(ControlCommands));
/// <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>
public static RoutedCommand Next { get; } = new RoutedCommand("Next", typeof(ControlCommands));
public static RoutedCommand Next { get; } = new RoutedCommand(nameof(Next), typeof(ControlCommands));
/// <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>
public static RoutedCommand Pm { get; } = new RoutedCommand("Pm", typeof(ControlCommands));
public static RoutedCommand Pm { get; } = new RoutedCommand(nameof(Pm), typeof(ControlCommands));
/// <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>
public static RoutedCommand HourChange { get; } = new RoutedCommand("HourChange", typeof(ControlCommands));
public static RoutedCommand HourChange { get; } = new RoutedCommand(nameof(HourChange), typeof(ControlCommands));
/// <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>
public static RoutedCommand SecondChange { get; } = new RoutedCommand("SecondChange", typeof(ControlCommands));
public static RoutedCommand SecondChange { get; } = new RoutedCommand(nameof(SecondChange), typeof(ControlCommands));
/// <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
View File
@@ -47,7 +47,7 @@ namespace HandyControl.Properties.Langs {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[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>
/// 查找类似 间隔10分钟 的本地化字符串。
/// </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>
@@ -186,4 +186,13 @@
<data name="Tip" xml:space="preserve">
<value>Prompt</value>
</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>
+9
View File
@@ -166,4 +166,13 @@
<data name="Tip" xml:space="preserve">
<value>提示</value>
</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>
@@ -93,4 +93,138 @@
</Style.Triggers>
</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>
+64
View File
@@ -79,4 +79,68 @@
</Style.Triggers>
</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>
+1 -1
View File
@@ -1,6 +1,6 @@
using System;
using System.Text.RegularExpressions;
using HandyControl.Data.Enum;
using HandyControl.Data;
namespace HandyControl.Tools
{
+1 -1
View File
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using HandyControl.Data.Enum;
using HandyControl.Data;
namespace HandyControl.Tools
{
+1 -1
View File
@@ -2,7 +2,7 @@
using System.Globalization;
using System.Threading;
using System.Windows;
using HandyControl.Data.Enum;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControlDemo.Data;
+1 -1
View File
@@ -1,5 +1,5 @@
using System;
using HandyControl.Data.Enum;
using HandyControl.Data;
namespace HandyControlDemo.Data
{
+10 -1
View File
@@ -47,7 +47,7 @@ namespace HandyControlDemo.Properties.Langs {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[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>
@@ -390,4 +390,7 @@
<data name="CircleProgressBar" xml:space="preserve">
<value>CircleProgressBar</value>
</data>
<data name="IsNotPhone" xml:space="preserve">
<value>It's not a phone number</value>
</data>
</root>
@@ -370,4 +370,7 @@
<data name="CircleProgressBar" xml:space="preserve">
<value>圆形进度条</value>
</data>
<data name="IsNotPhone" xml:space="preserve">
<value>不是手机号码</value>
</data>
</root>
@@ -5,15 +5,25 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="{DynamicResource RegionBrush}">
<controls:TransitioningContentControl>
<StackPanel Margin="32">
<controls:NumericUpDown x:Name="NumericUpDown"/>
<controls:NumericUpDown Margin="0,16,0,0" IsEnabled="False"/>
<StackPanel Margin="32" Orientation="Horizontal">
<StackPanel>
<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.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 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 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,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.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>
</controls:TransitioningContentControl>
</UserControl>
@@ -1,4 +1,6 @@
// ReSharper disable once CheckNamespace
using HandyControl.Data;
// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
{
public partial class NumericUpDownDemoCtl
@@ -6,6 +8,12 @@ namespace HandyControlDemo.UserControl
public NumericUpDownDemoCtl()
{
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"/>
</controls:EdgeElement.LeftContent>
</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>
<Image Source="../../Resources/Img/LeftMainContent/Slider_16x.png"/>
</controls:EdgeElement.LeftContent>
@@ -124,7 +124,7 @@
</TabItem>
<TabItem Header="{x:Static langs:Lang.Controls}">
<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>
<Image Source="../../Resources/Img/LeftMainContent/NumericListBox_16x.png"/>
</controls:EdgeElement.LeftContent>
@@ -134,7 +134,7 @@
<Image Source="../../Resources/Img/LeftMainContent/ColorWheel_16x.png"/>
</controls:EdgeElement.LeftContent>
</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>
<Image Source="../../Resources/Img/LeftMainContent/ShapeArcRing_16x.png"/>
</controls:EdgeElement.LeftContent>
@@ -5,7 +5,7 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Height="28"
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>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
@@ -5,7 +5,7 @@ using System.Windows;
using System.Windows.Controls;
using GalaSoft.MvvmLight.Messaging;
using HandyControl.Controls;
using HandyControl.Data.Enum;
using HandyControl.Data;
using HandyControlDemo.Data;
using HandyControlDemo.Tools;