PowerToys/Plugins/Wox.Plugin.Program/StringEmptyConverter.cs

28 lines
728 B
C#
Raw Normal View History

2014-03-29 14:42:43 +08:00
using System;
2016-01-07 05:34:42 +08:00
using System.Globalization;
2014-03-29 14:42:43 +08:00
using System.Windows.Data;
using System.Windows.Markup;
namespace Wox.Plugin.Program
2014-03-29 14:42:43 +08:00
{
public class StringEmptyConverter : MarkupExtension, IValueConverter
{
2016-01-07 05:34:42 +08:00
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2014-03-29 14:42:43 +08:00
{
return string.IsNullOrEmpty((string)value) ? parameter : value;
}
public object ConvertBack(
2016-01-07 05:34:42 +08:00
object value, Type targetType, object parameter, CultureInfo culture)
2014-03-29 14:42:43 +08:00
{
throw new NotSupportedException();
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
}