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
@@ -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;