mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 05:52:19 +02:00
Fix title aligment issue when subtitle is empty.
This commit is contained in:
@@ -37,11 +37,11 @@
|
|||||||
</Image>
|
</Image>
|
||||||
<Grid Margin="5 0 5 0" Grid.Column="1">
|
<Grid Margin="5 0 5 0" Grid.Column="1">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition x:Name="SubTitleRowDefinition"></RowDefinition>
|
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Style="{DynamicResource ItemTitleStyle}" VerticalAlignment="Center" x:Name="tbTitle" Text="{Binding Title}"></TextBlock>
|
<TextBlock Style="{DynamicResource ItemTitleStyle}" VerticalAlignment="Center" x:Name="tbTitle" Text="{Binding Title}"></TextBlock>
|
||||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}"></TextBlock>
|
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" Visibility="{Binding SubTitle, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}"></TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
26
Wox/StringNullOrEmptyToVisibilityConverter.cs
Normal file
26
Wox/StringNullOrEmptyToVisibilityConverter.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -144,6 +144,7 @@
|
|||||||
<Compile Include="SettingWindow.xaml.cs">
|
<Compile Include="SettingWindow.xaml.cs">
|
||||||
<DependentUpon>SettingWindow.xaml</DependentUpon>
|
<DependentUpon>SettingWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="StringNullOrEmptyToVisibilityConverter.cs" />
|
||||||
<Compile Include="WebSearchSetting.xaml.cs">
|
<Compile Include="WebSearchSetting.xaml.cs">
|
||||||
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user