50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
namespace Haftmittel
|
|
{
|
|
[ValueConversion(typeof(Brushes), typeof(bool))]
|
|
class ClassKonwerterNaKolory : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value is bool)
|
|
{
|
|
if ((bool)value)
|
|
{
|
|
return Brushes.Red;
|
|
}
|
|
else
|
|
{
|
|
return Brushes.White;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return Brushes.White;
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value is Brushes)
|
|
{
|
|
if ((value as Brush) == Brushes.Red)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|