root / trunk / Pithos.Client.WPF / Converters / NullToVisibilityConverter.cs @ 3ddbb7b8
History | View | Annotate | Download (820 Bytes)
1 |
using System; |
---|---|
2 |
using System.Globalization; |
3 |
using System.Windows; |
4 |
using System.Windows.Data; |
5 |
|
6 |
namespace Pithos.Client.WPF.Converters |
7 |
{ |
8 |
/// <summary> |
9 |
/// Returns Visible if the value is not null, Collapsed otherwise |
10 |
/// </summary> |
11 |
public class NullToVisibilityConverter:IValueConverter |
12 |
{ |
13 |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
14 |
{ |
15 |
bool invert = (parameter != null); |
16 |
if (value==null) |
17 |
return invert?Visibility.Visible:Visibility.Collapsed; |
18 |
return invert?Visibility.Collapsed:Visibility.Visible; |
19 |
} |
20 |
|
21 |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
22 |
{ |
23 |
throw new NotImplementedException(); |
24 |
} |
25 |
} |
26 |
} |