- Add BoolToTranslation Logic by Style in Program

- Add Responsive Width for Removing horizon scrollbar
This commit is contained in:
DB p 2022-12-09 10:15:14 +09:00
parent 3e85ca98c9
commit 8498883cd9
3 changed files with 35 additions and 8 deletions

View file

@ -12,6 +12,8 @@
<system:String x:Key="flowlauncher_plugin_program_enable">Enable</system:String>
<system:String x:Key="flowlauncher_plugin_program_enabled">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable">Disable</system:String>
<system:String x:Key="flowlauncher_plugin_program_true">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_false">Disabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_location">Location</system:String>
<system:String x:Key="flowlauncher_plugin_program_all_programs">All Programs</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes">File Type</system:String>

View file

@ -149,7 +149,8 @@
MouseDoubleClick="programSourceView_MouseDoubleClick"
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
SelectionChanged="programSourceView_SelectionChanged"
SelectionMode="Extended">
SelectionMode="Extended"
SizeChanged="ListView_SizeChanged">
<ListView.View>
<GridView>
<GridViewColumn Width="150" Header="{DynamicResource flowlauncher_plugin_program_name}">
@ -159,20 +160,28 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_enabled}">
<GridViewColumn Width="90" Header="{DynamicResource flowlauncher_plugin_program_enabled}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock
MaxWidth="60"
Text="{Binding Enabled}"
TextAlignment="Center" />
<TextBlock x:Name="ListViewEnabled" TextAlignment="Left">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_false}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_true}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="550" Header="{DynamicResource flowlauncher_plugin_program_location}">
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_location}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" />
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

View file

@ -9,6 +9,7 @@ using Flow.Launcher.Plugin.Program.Views.Commands;
using Flow.Launcher.Plugin.Program.Programs;
using System.ComponentModel;
using System.Windows.Data;
using System;
namespace Flow.Launcher.Plugin.Program.Views
{
@ -383,5 +384,20 @@ namespace Flow.Launcher.Plugin.Program.Views
{
return items.All(x => _settings.ProgramSources.Any(y => y.UniqueIdentifier == x.UniqueIdentifier));
}
private void ListView_SizeChanged(object sender, SizeChangedEventArgs e)
{
ListView listView = sender as ListView;
GridView gView = listView.View as GridView;
var workingWidth = listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar
var col1 = 0.25;
var col2 = 0.15;
var col3 = 0.60;
gView.Columns[0].Width = workingWidth * col1;
gView.Columns[1].Width = workingWidth * col2;
gView.Columns[2].Width = workingWidth * col3;
}
}
}