Controls: Rewrite UnitTextBox as extension of TextBox instead of UserControl
This commit is contained in:
16
Elwig/Controls/WidthToMarginConverter.cs
Normal file
16
Elwig/Controls/WidthToMarginConverter.cs
Normal file
@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user