Skip to content

Commit 8498883

Browse files
committed
- Add BoolToTranslation Logic by Style in Program
- Add Responsive Width for Removing horizon scrollbar
1 parent 3e85ca9 commit 8498883

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<system:String x:Key="flowlauncher_plugin_program_enable">Enable</system:String>
1313
<system:String x:Key="flowlauncher_plugin_program_enabled">Enabled</system:String>
1414
<system:String x:Key="flowlauncher_plugin_program_disable">Disable</system:String>
15+
<system:String x:Key="flowlauncher_plugin_program_true">Enabled</system:String>
16+
<system:String x:Key="flowlauncher_plugin_program_false">Disabled</system:String>
1517
<system:String x:Key="flowlauncher_plugin_program_location">Location</system:String>
1618
<system:String x:Key="flowlauncher_plugin_program_all_programs">All Programs</system:String>
1719
<system:String x:Key="flowlauncher_plugin_program_suffixes">File Type</system:String>

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@
149149
MouseDoubleClick="programSourceView_MouseDoubleClick"
150150
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
151151
SelectionChanged="programSourceView_SelectionChanged"
152-
SelectionMode="Extended">
152+
SelectionMode="Extended"
153+
SizeChanged="ListView_SizeChanged">
153154
<ListView.View>
154155
<GridView>
155156
<GridViewColumn Width="150" Header="{DynamicResource flowlauncher_plugin_program_name}">
@@ -159,20 +160,28 @@
159160
</DataTemplate>
160161
</GridViewColumn.CellTemplate>
161162
</GridViewColumn>
162-
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_enabled}">
163+
<GridViewColumn Width="90" Header="{DynamicResource flowlauncher_plugin_program_enabled}">
163164
<GridViewColumn.CellTemplate>
164165
<DataTemplate>
165-
<TextBlock
166-
MaxWidth="60"
167-
Text="{Binding Enabled}"
168-
TextAlignment="Center" />
166+
<TextBlock x:Name="ListViewEnabled" TextAlignment="Left">
167+
<TextBlock.Style>
168+
<Style TargetType="TextBlock">
169+
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_false}" />
170+
<Style.Triggers>
171+
<DataTrigger Binding="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Value="True">
172+
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_true}" />
173+
</DataTrigger>
174+
</Style.Triggers>
175+
</Style>
176+
</TextBlock.Style>
177+
</TextBlock>
169178
</DataTemplate>
170179
</GridViewColumn.CellTemplate>
171180
</GridViewColumn>
172-
<GridViewColumn Width="550" Header="{DynamicResource flowlauncher_plugin_program_location}">
181+
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_location}">
173182
<GridViewColumn.CellTemplate>
174183
<DataTemplate>
175-
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" />
184+
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" TextTrimming="CharacterEllipsis" />
176185
</DataTemplate>
177186
</GridViewColumn.CellTemplate>
178187
</GridViewColumn>

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Flow.Launcher.Plugin.Program.Programs;
1010
using System.ComponentModel;
1111
using System.Windows.Data;
12+
using System;
1213

1314
namespace Flow.Launcher.Plugin.Program.Views
1415
{
@@ -383,5 +384,20 @@ private bool IsAllItemsUserAdded(List<ProgramSource> items)
383384
{
384385
return items.All(x => _settings.ProgramSources.Any(y => y.UniqueIdentifier == x.UniqueIdentifier));
385386
}
387+
388+
private void ListView_SizeChanged(object sender, SizeChangedEventArgs e)
389+
{
390+
ListView listView = sender as ListView;
391+
GridView gView = listView.View as GridView;
392+
393+
var workingWidth = listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar
394+
var col1 = 0.25;
395+
var col2 = 0.15;
396+
var col3 = 0.60;
397+
398+
gView.Columns[0].Width = workingWidth * col1;
399+
gView.Columns[1].Width = workingWidth * col2;
400+
gView.Columns[2].Width = workingWidth * col3;
401+
}
386402
}
387403
}

0 commit comments

Comments
 (0)