More theme changes

This commit is contained in:
Ben
2015-07-06 13:41:46 +01:00
parent d6bd1678b4
commit cbbc7c25fa
24 changed files with 174 additions and 101 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace Filtration.Common.Converters
{
internal class BoolInverterConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is bool)
{
return !(bool)value;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is bool)
{
return !(bool)value;
}
return value;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace Filtration.Common.Converters
{
public class ColorToSolidColorBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value != null ? new SolidColorBrush((Color)value) : null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
return ((SolidColorBrush)value).Color;
return null;
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Filtration.Common.Converters
{
internal class InverseBooleanVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool && targetType == typeof (Visibility))
{
var val = (bool) value;
if (val)
{
return Visibility.Collapsed;
}
if (parameter is Visibility)
{
return parameter;
}
return Visibility.Visible;
}
if (value != null)
{
return Visibility.Collapsed;
}
if (parameter is Visibility)
{
return parameter;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Filtration.Common.Converters
{
internal class StringToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (String.IsNullOrEmpty((string)value))
{
return Visibility.Collapsed;
}
else
{
return Visibility.Visible;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}