Files
PowerToys/src/modules/peek/Peek.FilePreviewer/FilePreview.xaml
Dave Rayment a70aafb3b8 [Peek]Update FilePreviewer to prevent tooltips from obscuring title bar controls (#34718)
* Update FilePreviewer to prevent tooltips from obscuring title bar controls. Fixes #34496

* Small tidy to pointer move handler and StringBuilder setup.
2024-09-23 16:00:28 +01:00

113 lines
5.5 KiB
XML

<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<UserControl
x:Class="Peek.FilePreviewer.FilePreview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Peek.FilePreviewer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Peek.FilePreviewer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:previewers="using:Peek.FilePreviewer.Previewers"
mc:Ignorable="d">
<Grid>
<ProgressRing
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" />
<controls:ShellPreviewHandlerControl
x:Name="ShellPreviewHandlerPreview"
HandlerError="ShellPreviewHandlerPreview_HandlerError"
HandlerLoaded="ShellPreviewHandlerPreview_HandlerLoaded"
HandlerVisibility="{x:Bind IsPreviewVisible(ShellPreviewHandlerPreviewer, Previewer.State), Mode=OneWay}"
Source="{x:Bind ShellPreviewHandlerPreviewer.Preview, Mode=OneWay}" />
<Image
x:Name="ImagePreview"
MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}"
MaxHeight="{x:Bind ImagePreviewer.MaxImageSize.Height, Mode=OneWay}"
PointerMoved="ToolTipParentControl_PointerMoved"
Source="{x:Bind ImagePreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(ImagePreviewer, Previewer.State), Mode=OneWay}">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind InfoTooltip, Mode=OneWay}" />
</ToolTipService.ToolTip>
</Image>
<MediaPlayerElement
x:Name="VideoPreview"
AreTransportControlsEnabled="True"
AutoPlay="True"
FlowDirection="LeftToRight"
PointerMoved="ToolTipParentControl_PointerMoved"
Source="{x:Bind VideoPreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(VideoPreviewer, Previewer.State), Mode=OneWay}">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind InfoTooltip, Mode=OneWay}" />
</ToolTipService.ToolTip>
<MediaPlayerElement.KeyboardAccelerators>
<KeyboardAccelerator Key="Space" Invoked="KeyboardAccelerator_Space_Invoked" />
</MediaPlayerElement.KeyboardAccelerators>
<MediaPlayerElement.TransportControls>
<MediaTransportControls
x:Name="mediaTransport"
Width="auto"
MaxWidth="800"
IsCompact="True" />
</MediaPlayerElement.TransportControls>
</MediaPlayerElement>
<controls:AudioControl
x:Name="AudioPreview"
Source="{x:Bind AudioPreviewer.Preview, Mode=OneWay}"
ToolTipText="{x:Bind InfoTooltip, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(AudioPreviewer, Previewer.State), Mode=OneWay}" />
<controls:BrowserControl
x:Name="BrowserPreview"
x:Load="True"
CustomContextMenu="{x:Bind BrowserPreviewer.CustomContextMenu, Mode=OneWay}"
DOMContentLoaded="BrowserPreview_DOMContentLoaded"
FlowDirection="LeftToRight"
IsDevFilePreview="{x:Bind BrowserPreviewer.IsDevFilePreview, Mode=OneWay}"
NavigationCompleted="PreviewBrowser_NavigationCompleted"
Source="{x:Bind BrowserPreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(BrowserPreviewer, Previewer.State), Mode=OneWay, FallbackValue=Collapsed}" />
<controls:ArchiveControl
x:Name="ArchivePreview"
DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}"
FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}"
LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}"
Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}"
Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" />
<controls:DriveControl
x:Name="DrivePreview"
Source="{x:Bind DrivePreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(DrivePreviewer, Previewer.State), Mode=OneWay}" />
<controls:SpecialFolderPreview
x:Name="SpecialFolderPreview"
LoadingState="{x:Bind SpecialFolderPreviewer.State, Mode=OneWay}"
Source="{x:Bind SpecialFolderPreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(SpecialFolderPreviewer, Previewer.State), Mode=OneWay}" />
<controls:UnsupportedFilePreview
x:Name="UnsupportedFilePreview"
LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}"
Source="{x:Bind UnsupportedFilePreviewer.Preview, Mode=OneWay}"
Visibility="{x:Bind IsUnsupportedPreviewVisible(UnsupportedFilePreviewer, Previewer.State), Mode=OneWay}" />
</Grid>
<UserControl.KeyboardAccelerators>
<KeyboardAccelerator
Key="C"
Invoked="KeyboardAccelerator_CtrlC_Invoked"
Modifiers="Control" />
</UserControl.KeyboardAccelerators>
</UserControl>