public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue) { return(null); } ButtonPosMode PosMode = (ButtonPosMode)values[0]; int CustomTopMargin = (int)values[1]; Thickness ret = new Thickness(0); switch (PosMode) { case ButtonPosMode.Center: break; case ButtonPosMode.Upper: ret.Top = 10; break; case ButtonPosMode.Lower: ret.Top = 52; break; case ButtonPosMode.Custom: ret.Top = CustomTopMargin; break; default: break; } return(ret); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ButtonPosMode PosMode = (ButtonPosMode)value; if (PosMode == ButtonPosMode.Center) { return(VerticalAlignment.Center); } return(VerticalAlignment.Top); }