From c425313ae61b749f025352547471a168361b1464 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Wed, 19 Feb 2014 23:42:21 +0800 Subject: [PATCH] Fix title aligment issue when subtitle is empty. --- Wox/ResultPanel.xaml | 6 ++--- Wox/StringNullOrEmptyToVisibilityConverter.cs | 26 +++++++++++++++++++ Wox/Wox.csproj | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Wox/StringNullOrEmptyToVisibilityConverter.cs diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index 42806e17d4..b68df11cf2 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -37,11 +37,11 @@ - - + + - + diff --git a/Wox/StringNullOrEmptyToVisibilityConverter.cs b/Wox/StringNullOrEmptyToVisibilityConverter.cs new file mode 100644 index 0000000000..8ed4b71c86 --- /dev/null +++ b/Wox/StringNullOrEmptyToVisibilityConverter.cs @@ -0,0 +1,26 @@ +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; + } + } +} \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 0580c2c3b2..8b6a91e461 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -144,6 +144,7 @@ SettingWindow.xaml + WebSearchSetting.xaml