From 277767f101f6949c82ad55332902f1ad4afd0a34 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Fri, 25 Jul 2025 09:55:26 +0800
Subject: [PATCH 1/2] Do not create customized preview panel when preview is
off
---
Flow.Launcher/MainWindow.xaml | 6 +++---
Flow.Launcher/ViewModel/MainViewModel.cs | 7 +++++++
Flow.Launcher/ViewModel/ResultViewModel.cs | 2 --
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 9ff38a56442..fe5423592fb 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -534,10 +534,10 @@
MinHeight="380"
MaxHeight="{Binding ElementName=ResultListBox, Path=ActualHeight}"
Padding="0 0 10 10"
- d:DataContext="{d:DesignInstance vm:ResultViewModel}"
- DataContext="{Binding PreviewSelectedItem, Mode=OneWay}"
+
+
Visibility="{Binding ShowCustomizedPreview}">
-
+
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 045ff46cc9e..d492f28c58c 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -9,6 +9,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
+using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.DependencyInjection;
@@ -883,6 +884,12 @@ private ResultsViewModel SelectedResults
}
}
+ public Visibility ShowCustomizedPreview
+ => InternalPreviewVisible && PreviewSelectedItem?.Result.PreviewPanel != null ? Visibility.Visible : Visibility.Collapsed;
+
+ public UserControl CustomizedPreviewControl
+ => ShowCustomizedPreview == Visibility.Visible ? PreviewSelectedItem?.Result.PreviewPanel.Value : null;
+
public Visibility ProgressBarVisibility { get; set; }
public Visibility MainWindowVisibility { get; set; }
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index c58abae28ee..d4382fb7f16 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -66,8 +66,6 @@ public ResultViewModel(Result result, Settings settings)
public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;
- public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
-
public Visibility ShowIcon
{
get
From 14af7af2d1225a0814e91f747f97b5871a0f40fb Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Fri, 25 Jul 2025 15:32:09 +0800
Subject: [PATCH 2/2] Remove blank lines
---
Flow.Launcher/MainWindow.xaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index fe5423592fb..132ec838978 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -534,8 +534,6 @@
MinHeight="380"
MaxHeight="{Binding ElementName=ResultListBox, Path=ActualHeight}"
Padding="0 0 10 10"
-
-
Visibility="{Binding ShowCustomizedPreview}">