moving converters, fixing spacing issues

This commit is contained in:
Clint Rutkas
2019-12-12 13:51:58 -08:00
parent a187456ac3
commit 24664cc859
14 changed files with 93 additions and 85 deletions

View File

@@ -209,57 +209,4 @@ namespace FancyZonesEditor
model.Delete();
}
}
public class BooleanToBrushConverter : IValueConverter
{
private static Brush c_selectedBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x78, 0xD7));
private static Brush c_normalBrush = new SolidColorBrush(Color.FromRgb(0xF2, 0xF2, 0xF2));
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return ((bool)value) ? c_selectedBrush : c_normalBrush;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value == c_selectedBrush;
}
}
public class ModelToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Settings.IsPredefinedLayout((LayoutModel)value) ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
public class BooleanToIntConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool)
{
return (bool)value == true ? 1 : 0;
}
return 0;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is int)
{
return (int)value == 1;
}
return false;
}
}
}