| 12345678910111213141516171819202122232425262728293031323334 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Data;
 
- namespace FurnaceUI.Converter
 
- {
 
-    public  class StringformatConvert : IValueConverter
 
-     {
 
-         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 
-         {
 
-             if (value == null) return value;
 
-             string s = value.ToString();
 
-             int leng;
 
-             if (int.TryParse(parameter.ToString(), out leng))
 
-             {
 
-                 if (s.Length <= leng)
 
-                     return s;
 
-                 else
 
-                     return s.Substring(0, leng) + "...";
 
-             }
 
-             else
 
-                 return string.Empty;
 
-         }
 
-         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 
-         {
 
-             throw new NotImplementedException();
 
-         }
 
-     }
 
- }
 
 
  |