34 lines
862 B
C#
34 lines
862 B
C#
|
|
using System;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using System.Windows;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
|
|||
|
|
namespace BeWo.Converter
|
|||
|
|
{
|
|||
|
|
public class StringFormatConverter : IValueConverter
|
|||
|
|
{
|
|||
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
Object val = String.Empty;
|
|||
|
|
|
|||
|
|
if (value != null && value != DependencyProperty.UnsetValue)
|
|||
|
|
{
|
|||
|
|
val = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (parameter is string)
|
|||
|
|
{
|
|||
|
|
return string.Format(parameter as string, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|