mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-06 17:53:17 +08:00
24 lines
746 B
C#
24 lines
746 B
C#
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace CRSim.ScreenSimulator.Converters
|
|
{
|
|
public class TextSpacingConverter : IValueConverter
|
|
{
|
|
public int TextLength { get; set; } = 2;
|
|
public string Spacing { get; set; } = " ";
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is string s && s.Length == TextLength)
|
|
{
|
|
return string.Join(Spacing, s.ToCharArray());
|
|
}
|
|
return value;
|
|
}
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|