Skip to content

Commit 8e05f31

Browse files
authored
Merge pull request #1383 from Sparrkle/ProgressBarBindingError
Fixed Progressbar Binding Error (ProgressBar Value is Not Nullable)
2 parents e0c3fa8 + 63f1dd9 commit 8e05f31

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

Flow.Launcher/ResultListBox.xaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,18 @@
114114
<ProgressBar
115115
x:Name="progressbarResult"
116116
Foreground="{Binding Result.ProgressBarColor}"
117-
Style="{DynamicResource ProgressBarResult}"
118-
Value="{Binding Result.ProgressBar}" />
117+
Value="{Binding ResultProgress, Mode=OneWay}">
118+
<ProgressBar.Style>
119+
<Style TargetType="ProgressBar" BasedOn="{StaticResource ProgressBarResult}">
120+
<Setter Property="Visibility" Value="Visible"/>
121+
<Style.Triggers>
122+
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
123+
<Setter Property="Visibility" Value="Collapsed"/>
124+
</DataTrigger>
125+
</Style.Triggers>
126+
</Style>
127+
</ProgressBar.Style>
128+
</ProgressBar>
119129
<TextBlock
120130
x:Name="Title"
121131
VerticalAlignment="Center"

Flow.Launcher/Themes/Base.xaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:system="clr-namespace:System;assembly=mscorlib"
55
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure">
6-
6+
77
<!-- Further font customisations are dynamically loaded in Theme.cs -->
88
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
99
<Setter Property="BorderThickness" Value="0" />
@@ -89,11 +89,6 @@
8989
<Setter Property="Minimum" Value="0" />
9090
<Setter Property="Visibility" Value="Visible" />
9191
<Setter Property="Foreground" Value="#26a0da " />
92-
<Style.Triggers>
93-
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
94-
<Setter Property="Visibility" Value="Collapsed" />
95-
</DataTrigger>
96-
</Style.Triggers>
9792
</Style>
9893

9994
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ private async ValueTask LoadImageAsync()
162162
}
163163

164164
public Result Result { get; }
165+
public int ResultProgress
166+
{
167+
get
168+
{
169+
if (Result.ProgressBar == null)
170+
return 0;
171+
172+
return Result.ProgressBar.Value;
173+
}
174+
}
165175

166176
public string QuerySuggestionText { get; set; }
167177

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
8080
internal static Result CreateDriveSpaceDisplayResult(string path, bool windowsIndexed = false)
8181
{
8282
var progressBarColor = "#26a0da";
83-
int? progressValue = null;
83+
int progressValue = 0;
8484
var title = string.Empty; // hide title when use progress bar,
8585
var driveLetter = path.Substring(0, 1).ToUpper();
8686
var driveName = driveLetter + ":\\";

0 commit comments

Comments
 (0)