using System.Globalization; namespace HKW.WPF.Converters; /// /// 字符串格式化器 /// 示例: /// /// /// /// /// /// OR /// /// /// /// /// ]]> /// public class StringFormatConverter : MultiValueConverterBase { /// /// /// /// /// /// /// /// public override object Convert( object[] values, Type targetType, object parameter, 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); } } }