Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Jul 11, 2020
2 parents 345eee9 + 8b48ce9 commit 7c66586
Show file tree
Hide file tree
Showing 19 changed files with 365 additions and 195 deletions.
2 changes: 2 additions & 0 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
<a href="https://github.com/walterlv" target="_blank"><img style="border-radius:50%!important" width="64px" alt="walterlv" src="https://avatars3.githubusercontent.com/u/9959623?s=64&v=4"></a>
<a href="https://github.com/Luoyingliang" target="_blank"><img style="border-radius:50%!important" width="64px" alt="Luoyingliang" src="https://avatars2.githubusercontent.com/u/29297262?s=64&v=4"></a>
<a href="https://github.com/lindexi" target="_blank"><img style="border-radius:50%!important" width="64px" alt="lindexi" src="https://avatars3.githubusercontent.com/u/16054566?s=64&v=4"></a>
<a href="https://github.com/danwalmsley" target="_blank"><img style="border-radius:50%!important" width="64px" alt="danwalmsley" src="https://avatars1.githubusercontent.com/u/4672627?s=64&v=4"></a>
<a href="https://github.com/varKeytrap" target="_blank"><img style="border-radius:50%!important" width="64px" alt="varKeytrap" src="https://avatars0.githubusercontent.com/u/17864005?s=64&v=4"></a>

## Backers

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ This project is based on [HandyControl](https://github.com/handyOrg/HandyControl
<a href="https://github.com/walterlv" target="_blank"><img style="border-radius:50%!important" width="64px" alt="walterlv" src="https://avatars3.githubusercontent.com/u/9959623?s=64&v=4"></a>
<a href="https://github.com/Luoyingliang" target="_blank"><img style="border-radius:50%!important" width="64px" alt="Luoyingliang" src="https://avatars2.githubusercontent.com/u/29297262?s=64&v=4"></a>
<a href="https://github.com/lindexi" target="_blank"><img style="border-radius:50%!important" width="64px" alt="lindexi" src="https://avatars3.githubusercontent.com/u/16054566?s=64&v=4"></a>
<a href="https://github.com/danwalmsley" target="_blank"><img style="border-radius:50%!important" width="64px" alt="danwalmsley" src="https://avatars1.githubusercontent.com/u/4672627?s=64&v=4"></a>
<a href="https://github.com/varKeytrap" target="_blank"><img style="border-radius:50%!important" width="64px" alt="varKeytrap" src="https://avatars0.githubusercontent.com/u/17864005?s=64&v=4"></a>

## Backers

Expand All @@ -54,7 +56,6 @@ This project is based on [HandyControl](https://github.com/handyOrg/HandyControl
[![Visual Studio Community 2019](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/vs2019_logo.png)](https://visualstudio.microsoft.com/free-developer-offers/)
[![JetBrains](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/resharper_logo.png)](https://www.jetbrains.com/?from=HandyControl)
[![Cake](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/cake_logo.png)](https://cakebuild.net/)
[![AppVeyor](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/appveyor_logo.png)](https://www.appveyor.com/)
[![Gitter](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/gitter_logo.png)](https://gitter.im/)

## Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<StackPanel Margin="64">
<hc:PreviewSlider Name="PreviewSliderHorizontal" Width="300" Value="500" Maximum="1000">
<hc:PreviewSlider.PreviewContent>
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="{}{0:#0.0}"/>
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0.00"/>
</hc:PreviewSlider.PreviewContent>
</hc:PreviewSlider>
<hc:PreviewSlider Name="PreviewSliderVertical" Height="300" Value="200" Maximum="1000" Orientation="Vertical" Margin="0,16,0,0" HorizontalAlignment="Center">
<hc:PreviewSlider.PreviewContent>
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="{}{0:#0.0}"/>
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0.0"/>
</hc:PreviewSlider.PreviewContent>
</hc:PreviewSlider>
</StackPanel>
Expand Down
12 changes: 12 additions & 0 deletions src/Shared/HandyControl_Shared/Controls/Attach/InfoElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,17 @@ public static void SetMaxContentHeight(DependencyObject element, double value)

public static double GetMaxContentHeight(DependencyObject element)
=> (double) element.GetValue(MaxContentHeightProperty);

/// <summary>
/// 正则表达式
/// </summary>
public static readonly DependencyProperty RegexPatternProperty = DependencyProperty.RegisterAttached(
"RegexPattern", typeof(string), typeof(InfoElement), new PropertyMetadata(default(string)));

public static void SetRegexPattern(DependencyObject element, string value)
=> element.SetValue(RegexPatternProperty, value);

public static string GetRegexPattern(DependencyObject element)
=> (string) element.GetValue(RegexPatternProperty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public override void OnApplyTemplate()

_elementContent = GetTemplateChild(ElementContent) as FrameworkElement;
_elementPanel = GetTemplateChild(ElementPanel) as Panel;
UpdateContent();
}

public static readonly DependencyProperty RunawayProperty = DependencyProperty.Register(
Expand Down
13 changes: 10 additions & 3 deletions src/Shared/HandyControl_Shared/Controls/Input/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public bool IsError

public string ErrorStr
{
get => (string) GetValue(ErrorStrProperty);
get => (string)GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value);
}

Expand All @@ -58,7 +58,7 @@ public string ErrorStr

public TextType TextType
{
get => (TextType) GetValue(TextTypeProperty);
get => (TextType)GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value);
}

Expand Down Expand Up @@ -88,7 +88,14 @@ public virtual bool VerifyData()
{
if (TextType != TextType.Common)
{
result = Text.IsKindOf(TextType) ? OperationResult.Success() : OperationResult.Failed(Properties.Langs.Lang.FormatError);
var regexPattern = InfoElement.GetRegexPattern(this);
result = string.IsNullOrEmpty(regexPattern)
? Text.IsKindOf(TextType)
? OperationResult.Success()
: OperationResult.Failed(Properties.Langs.Lang.FormatError)
: Text.IsKindOf(regexPattern)
? OperationResult.Success()
: OperationResult.Failed(Properties.Langs.Lang.FormatError);
}
else
{
Expand Down
Loading

0 comments on commit 7c66586

Please sign in to comment.