using System;
using System.Windows;
using System.Windows.Data;
using System.Globalization;

namespace Elwig.Controls {
    public class WidthToMarginConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            return new Thickness(0, 0, 2 + (double)value, 0);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            return ((Thickness)value).Right - 2;
        }
    }
}
