More theme changes
This commit is contained in:
29
Filtration.Common/Converters/BooleanInverterConverter.cs
Normal file
29
Filtration.Common/Converters/BooleanInverterConverter.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Filtration.Common/Converters/StringToVisibilityConverter.cs
Normal file
27
Filtration.Common/Converters/StringToVisibilityConverter.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user