diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml index 0daa36e63fb..4479571e3c7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml @@ -7,6 +7,7 @@ xmlns:sys="clr-namespace:System;assembly=System.Runtime" d:DesignHeight="300" d:DesignWidth="300" + DataContext="{Binding RelativeSource={RelativeSource Self}}" mc:Ignorable="d"> @@ -20,40 +21,22 @@ - - - - + Source="{Binding PreviewImage, IsAsync=True, Mode=OneWay}" /> - - - + Text="{Binding FilePath, Mode=OneTime}" /> - - - + + + @@ -87,7 +70,7 @@ - + @@ -105,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 6e3cf8466b9..4dd0588ee60 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -21,22 +21,22 @@ public partial class PreviewPanel : UserControl { private static readonly string ClassName = nameof(PreviewPanel); - private string FilePath { 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; } = ""; + public string FilePath { get; } + public string FileName { 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 @@ -57,11 +57,11 @@ private set public PreviewPanel(Settings settings, string filePath, ResultType type) { - InitializeComponent(); - Settings = settings; - FilePath = filePath; + FileName = Path.GetFileName(filePath); + + InitializeComponent(); if (Settings.ShowFileSizeInPreviewPanel) {