Files
QuickLook/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml
2017-11-16 22:47:23 +02:00

40 lines
2.8 KiB
XML

<UserControl x:Class="QuickLook.Plugin.ImageViewer.ImagePanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.ImageViewer"
xmlns:animatedImage="clr-namespace:QuickLook.Plugin.ImageViewer.AnimatedImage"
mc:Ignorable="d"
x:Name="imagePanel"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Rectangle Visibility="{Binding BackgroundVisibility, ElementName=imagePanel}" RenderOptions.BitmapScalingMode="NearestNeighbor">
<Rectangle.Fill>
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background-b.png" AlignmentY="Top"
Viewport="0,0,32,32"
ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
<ScrollViewer x:Name="viewPanel" BorderThickness="0" HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True">
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None" Meta="{Binding Meta, ElementName=imagePanel}"
RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=imagePanel}"
AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" />
</ScrollViewer>
<Border x:Name="zoomLevelInfo" CornerRadius="5" IsHitTestVisible="False" Opacity="0" Background="Gray" Padding="15,4,15,4" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Foreground="White" FontSize="18" Text="{Binding ElementName=imagePanel, Path=ZoomFactor, StringFormat={}{0:P0}}" />
<Border.Resources>
<Storyboard x:Key="StoryboardShowZoomLevelInfo">
<DoubleAnimationUsingKeyFrames Storyboard.Target="{Binding Source={x:Reference zoomLevelInfo}}" Storyboard.TargetProperty="Opacity">
<DoubleAnimationUsingKeyFrames.KeyFrames>
<LinearDoubleKeyFrame Value="0.9" KeyTime="0:0:0.1" />
<LinearDoubleKeyFrame Value="0.9" KeyTime="0:0:0.6" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.8" />
</DoubleAnimationUsingKeyFrames.KeyFrames>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Border.Resources>
</Border>
</Grid>
</UserControl>