Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Converters / EmptyToVisibilityConverter.cs @ 2c27cdd0

History | View | Annotate | Download (872 Bytes)

1
using System;
2
using System.Collections.Generic;
3
using System.Globalization;
4
using System.Linq;
5
using System.Text;
6
using System.Windows;
7
using System.Windows.Data;
8

    
9
namespace Pithos.Client.WPF.Converters
10
{
11
    /// <summary>
12
    /// Returns Visible if a string value contains data, Hidden otherwise
13
    /// </summary>
14
    public class EmptyToVisibilityConverter:IValueConverter
15
    {
16
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17
        {
18
            var stringValue = value as string;
19

    
20
            if (String.IsNullOrWhiteSpace(stringValue))
21
                return Visibility.Hidden;
22
            return Visibility.Visible;
23
        }
24

    
25
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26
        {
27
            throw new NotImplementedException();
28
        }
29
    }
30
}