namespace Account.UI.Converters
{
    public class CardNumberObfuscatorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var cardNumber =  value as string;
            var numberSet =   cardNumber.Split(' ');
            var last4Digits = numberSet[numberSet.Length - 1];
            return $"XXXX XXXX XXXX {last4Digits}";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}

ObfusatedCardNumbers

Advertisements