You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Windows.Data; |
|
using System.Globalization; |
|
using System.Windows; |
|
using System.Collections; |
|
|
|
namespace ICSharpCode.XamlDesigner.Converters |
|
{ |
|
public class EnumToIntConverter : IValueConverter |
|
{ |
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
return (int)value; |
|
} |
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
return value; |
|
} |
|
} |
|
|
|
public class CollapsedWhenFalse : IValueConverter |
|
{ |
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
return (bool)value ? Visibility.Visible : Visibility.Collapsed; |
|
} |
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
throw new NotImplementedException(); |
|
} |
|
} |
|
|
|
public class FalseWhenZero : IValueConverter |
|
{ |
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
if (value == null || (int)value == 0) { |
|
return false; |
|
} |
|
return true; |
|
} |
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
throw new NotImplementedException(); |
|
} |
|
} |
|
|
|
public class LevelConverter : IValueConverter |
|
{ |
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
return new Thickness(5 + 19 * (int)value, 0, 5, 0); |
|
} |
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
{ |
|
throw new NotImplementedException(); |
|
} |
|
} |
|
}
|
|
|