From 9f8ff121553a9e23246086ecd636bccc714d77df Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sun, 17 Aug 2025 14:13:32 +0800
Subject: [PATCH 1/8] Bind DataContext to itself
---
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index 0daa36e63fb..b9417addf22 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
+ DataContext="{Binding RelativeSource={RelativeSource Self}}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
From f1628eec66e7bd26b4e68aaae48157157d6c96ad Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sun, 17 Aug 2025 14:14:02 +0800
Subject: [PATCH 2/8] Add MaxHeight & MaxWidth for preview image
---
.../Views/PreviewPanel.xaml | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index b9417addf22..08e2c8f243f 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -21,19 +21,10 @@
-
-
-
-
+ Source="{Binding PreviewImage, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
Date: Sun, 17 Aug 2025 14:14:17 +0800
Subject: [PATCH 3/8] Show FileName under preview image
---
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index 08e2c8f243f..aad27e764e8 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -31,7 +31,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Style="{DynamicResource PreviewItemTitleStyle}"
- Text="{Binding Result.Title}"
+ Text="{Binding FileName}"
TextAlignment="Center"
TextWrapping="Wrap" />
From 21299d153f481d56400b52271da40a19ef29a0ba Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sun, 17 Aug 2025 14:18:18 +0800
Subject: [PATCH 4/8] Add FileName & FilePath as public properties
---
.../Views/PreviewPanel.xaml.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
index 6e3cf8466b9..c931a014e19 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
@@ -21,7 +21,8 @@ public partial class PreviewPanel : UserControl
{
private static readonly string ClassName = nameof(PreviewPanel);
- private string FilePath { get; }
+ public string FilePath { get; }
+ public string FileName { get; }
public string FileSize { get; private set; } = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
public string CreatedAt { get; } = "";
public string LastModifiedAt { get; } = "";
@@ -57,11 +58,11 @@ private set
public PreviewPanel(Settings settings, string filePath, ResultType type)
{
- InitializeComponent();
-
Settings = settings;
-
FilePath = filePath;
+ FileName = Path.GetFileName(filePath);
+
+ InitializeComponent();
if (Settings.ShowFileSizeInPreviewPanel)
{
From ce8b544ff5293afb4fcd3aaf22cddbad23118204 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sun, 17 Aug 2025 14:20:55 +0800
Subject: [PATCH 5/8] Display FilePath in preview panel
---
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index aad27e764e8..fe1df0dbe95 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -56,7 +56,7 @@
+ Text="{Binding FilePath}" />
Date: Sun, 17 Aug 2025 14:22:50 +0800
Subject: [PATCH 6/8] Remove unused trigger
---
.../Views/PreviewPanel.xaml | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index fe1df0dbe95..e4423ca478c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -37,15 +37,6 @@
-
-
-
Date: Sun, 17 Aug 2025 14:23:04 +0800
Subject: [PATCH 7/8] Apply style formatter
---
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index e4423ca478c..a432979518b 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -5,9 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
- DataContext="{Binding RelativeSource={RelativeSource Self}}"
d:DesignHeight="300"
d:DesignWidth="300"
+ DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
From 6751942179585433c153d4741234ef28faf0c126 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sun, 17 Aug 2025 14:30:03 +0800
Subject: [PATCH 8/8] Use Binding instead of RelativeResource for code quality
---
.../Views/PreviewPanel.xaml | 32 +++++++++----------
.../Views/PreviewPanel.xaml.cs | 25 +++++++--------
2 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
index a432979518b..4479571e3c7 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml
@@ -24,14 +24,14 @@
MaxWidth="96"
MaxHeight="96"
Margin="5 12 8 0"
- Source="{Binding PreviewImage, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
+ Source="{Binding PreviewImage, IsAsync=True, Mode=OneWay}" />
@@ -47,7 +47,7 @@
+ Text="{Binding FilePath, Mode=OneTime}" />
-
-
-
+
+
+
@@ -70,7 +70,7 @@
-
+
@@ -88,7 +88,7 @@
Style="{DynamicResource PreviewItemSubTitleStyle}"
Text="{DynamicResource FileSize}"
TextWrapping="Wrap"
- Visibility="{Binding FileSizeVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
+ Visibility="{Binding FileSizeVisibility, Mode=OneTime}" />
+ Visibility="{Binding FileSizeVisibility, Mode=OneTime}" />
+ Visibility="{Binding CreatedAtVisibility, Mode=OneTime}" />
+ Visibility="{Binding CreatedAtVisibility, Mode=OneTime}" />
+ Visibility="{Binding LastModifiedAtVisibility, Mode=OneTime}" />
+ Visibility="{Binding LastModifiedAtVisibility, Mode=OneTime}" />
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
index c931a014e19..4dd0588ee60 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
@@ -23,21 +23,20 @@ public partial class PreviewPanel : UserControl
public string FilePath { get; }
public string FileName { get; }
- public string FileSize { get; private set; } = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
- public string CreatedAt { get; } = "";
- public string LastModifiedAt { get; } = "";
+
+ [ObservableProperty]
+ private string _fileSize = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
+
+ [ObservableProperty]
+ private string _createdAt = "";
+
+ [ObservableProperty]
+ private string _lastModifiedAt = "";
+
+ [ObservableProperty]
private ImageSource _previewImage = new BitmapImage();
- private Settings Settings { get; }
- public ImageSource PreviewImage
- {
- get => _previewImage;
- private set
- {
- _previewImage = value;
- OnPropertyChanged();
- }
- }
+ private Settings Settings { get; }
public Visibility FileSizeVisibility => Settings.ShowFileSizeInPreviewPanel
? Visibility.Visible