2014-02-19 23:42:21 +08:00
|
|
|
using System;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Windows;
|
|
|
|
|
2014-05-24 16:06:09 +08:00
|
|
|
namespace Wox.Converters
|
2014-02-19 23:42:21 +08:00
|
|
|
{
|
2014-05-24 16:06:09 +08:00
|
|
|
public class StringNullOrEmptyToVisibilityConverter : ConvertorBase<StringNullOrEmptyToVisibilityConverter>
|
2014-02-19 23:42:21 +08:00
|
|
|
{
|
2014-05-24 16:06:09 +08:00
|
|
|
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 23:42:21 +08:00
|
|
|
{
|
2014-05-24 16:06:09 +08:00
|
|
|
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
|
2014-02-19 23:42:21 +08:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:06:09 +08:00
|
|
|
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 23:42:21 +08:00
|
|
|
{
|
2014-05-24 16:06:09 +08:00
|
|
|
return null;
|
2014-02-19 23:42:21 +08:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:06:09 +08:00
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
2014-02-19 23:42:21 +08:00
|
|
|
{
|
2014-05-24 16:06:09 +08:00
|
|
|
return this;
|
2014-02-19 23:42:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|