update to v1.3.1
This commit is contained in:
1 parent
ec2f13f0a0
commit
6c8a679c3e
65 files changed
+2108
-226
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControlDemo.Tools.Converter
|
||||
{
|
||||
public class StringRepeatConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string strValue)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
int num;
|
||||
if (parameter is string numStr)
|
||||
{
|
||||
if (!int.TryParse(numStr, out num))
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
}
|
||||
else if(parameter is int intValue)
|
||||
{
|
||||
num = intValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
for (var i = 0; i < num; i++)
|
||||
{
|
||||
builder.Append(strValue);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user