Do not create customized preview panel when preview is off

This commit is contained in:
Jack251970 2025-07-25 09:55:26 +08:00
parent 65cfb29cfd
commit 277767f101
3 changed files with 10 additions and 5 deletions

View file

@ -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}">
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
<ContentControl Content="{Binding CustomizedPreviewControl}" />
</Border>
</Grid>
</Grid>

View file

@ -9,6 +9,7 @@ using System.Threading.Channels;
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 @@ namespace Flow.Launcher.ViewModel
}
}
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; }

View file

@ -66,8 +66,6 @@ namespace Flow.Launcher.ViewModel
public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;
public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
public Visibility ShowIcon
{
get