comparison MetroWpf/MetroWpf.Xaml/Converters/CollapseWhenZeroConverter.cs @ 15:060f02cd4591

Initial commit, pre airport work
author stevenh7776 stevenhollidge@hotmail.com
date Mon, 12 Mar 2012 23:05:21 +0800
parents
children
comparison
equal deleted inserted replaced
14:741981715d94 15:060f02cd4591
1 namespace MetroWpf.Xaml.Converters
2 {
3 using System;
4 using System.Globalization;
5 using System.Windows;
6 using System.Windows.Data;
7
8 public class CollapseWhenZeroConverter : IValueConverter
9 {
10 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 {
12 bool collapse = false;
13
14 var i = (int)value;
15 if (i == 0)
16 {
17 collapse = true;
18 }
19
20 if ((string)parameter == "Inverse")
21 {
22 collapse = !collapse;
23 }
24
25 return collapse ? Visibility.Collapsed : Visibility.Visible;
26 }
27
28 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
29 {
30 throw new NotSupportedException();
31 }
32 }
33 }