public class StringToIntConveter : IValueConverter
{
int convertAmount = 0;
int convertBackAmount = 0;
object? current;
string? curentText;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
current ??= value;
if(current == value)
{
convertAmount++;
}
else
{
current = value;
convertAmount = 1;
}
return ((ITableColumn)value).Value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
curentText ??= (string)value;
if (curentText == value)
{
convertBackAmount++;
}
else
{
curentText = (string)value;
convertBackAmount = 1;
}
return new IntColumn { Value = (string)value };
}
}