53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|