Reset Sources on Peek close

This commit is contained in:
Stefan Markovic 2023-05-25 17:43:20 +02:00
parent 675aac95d2
commit 6b63e809ef
3 changed files with 9 additions and 0 deletions

View File

@ -68,6 +68,13 @@ namespace Peek.FilePreviewer
_cancellationTokenSource.Dispose();
}
public void ResetSource()
{
ImagePreview.Source = null;
VideoPreview.Source = null;
BrowserPreview.Source = null;
}
private async void Previewer_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
// Fallback on DefaultPreviewer if we fail to load the correct Preview

View File

@ -35,6 +35,7 @@
NumberOfFiles="{x:Bind ViewModel.Items.Count, Mode=OneWay}" />
<fp:FilePreview
Name="FilePreviewer"
Grid.Row="1"
Item="{x:Bind ViewModel.CurrentItem, Mode=OneWay}"
PreviewSizeChanged="FilePreviewer_PreviewSizeChanged"

View File

@ -89,6 +89,7 @@ namespace Peek.UI
ViewModel.Uninitialize();
ViewModel.ScalingFactor = 1;
FilePreviewer.ResetSource();
}
/// <summary>