using System.Windows.Data; namespace VPet.House.Converters; /// /// 边距转换器 /// 示例: /// /// /// /// /// /// OR /// /// /// /// /// ]]> /// public class StringFormatConverter : IMultiValueConverter { public object Convert( object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture ) { var formatStr = (string)parameter; if (string.IsNullOrWhiteSpace(formatStr)) { formatStr = (string)values[0]; return string.Format(formatStr, values.Skip(1).ToArray()); } else { return string.Format(formatStr, values); } } public object[] ConvertBack( object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture ) { throw new NotImplementedException(); } }