32 lines
908 B
C#
32 lines
908 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Markup;
|
|
|
|
namespace DTS.Common.Converters
|
|
{
|
|
public class WidthConverter : MarkupExtension, IValueConverter
|
|
{
|
|
private static WidthConverter _instance;
|
|
|
|
#region IValueConverter Members
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
#endregion
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
return _instance ?? (_instance = new WidthConverter());
|
|
}
|
|
}
|
|
}
|