Dodaj pliki projektów.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
using System.Globalization;
|
||||
|
||||
namespace Haftmittel
|
||||
{
|
||||
/// <summary>
|
||||
/// true na jasnozielony, false na pomarańczowy
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(double), typeof(bool))]
|
||||
public class ClassKonwerterNaProcenty: IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
if ((bool)value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is double)
|
||||
{
|
||||
return ((double)value == 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user