Merge pull request #1383 from Sparrkle/ProgressBarBindingError

Fixed Progressbar Binding Error (ProgressBar Value is Not Nullable)
This commit is contained in:
Kevin Zhang 2022-09-30 21:24:56 -05:00 committed by GitHub
commit 8e05f312af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 9 deletions

View file

@ -114,8 +114,18 @@
<ProgressBar
x:Name="progressbarResult"
Foreground="{Binding Result.ProgressBarColor}"
Style="{DynamicResource ProgressBarResult}"
Value="{Binding Result.ProgressBar}" />
Value="{Binding ResultProgress, Mode=OneWay}">
<ProgressBar.Style>
<Style TargetType="ProgressBar" BasedOn="{StaticResource ProgressBarResult}">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ProgressBar.Style>
</ProgressBar>
<TextBlock
x:Name="Title"
VerticalAlignment="Center"

View file

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure">
<!-- Further font customisations are dynamically loaded in Theme.cs -->
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="0" />
@ -89,11 +89,6 @@
<Setter Property="Minimum" Value="0" />
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Foreground" Value="#26a0da " />
<Style.Triggers>
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">

View file

@ -162,6 +162,16 @@ namespace Flow.Launcher.ViewModel
}
public Result Result { get; }
public int ResultProgress
{
get
{
if (Result.ProgressBar == null)
return 0;
return Result.ProgressBar.Value;
}
}
public string QuerySuggestionText { get; set; }

View file

@ -80,7 +80,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal static Result CreateDriveSpaceDisplayResult(string path, bool windowsIndexed = false)
{
var progressBarColor = "#26a0da";
int? progressValue = null;
int progressValue = 0;
var title = string.Empty; // hide title when use progress bar,
var driveLetter = path.Substring(0, 1).ToUpper();
var driveName = driveLetter + ":\\";