mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-13 02:39:22 +08:00
26 lines
737 B
C#
26 lines
737 B
C#
|
using System;
|
||
|
using System.Globalization;
|
||
|
using System.Windows;
|
||
|
using System.Windows.Data;
|
||
|
using System.Windows.Markup;
|
||
|
|
||
|
namespace Wox
|
||
|
{
|
||
|
public class StringNullOrEmptyToVisibilityConverter : MarkupExtension, IValueConverter
|
||
|
{
|
||
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
||
|
{
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||
|
{
|
||
|
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
|
||
|
}
|
||
|
|
||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
}
|