Files
CRSim/CRSim.ScreenSimulator/Converters/TextSpacingConverter.cs
2025-04-05 22:12:38 +08:00

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();
}
}
}