2025-02-10 20:53:40 +08:00
|
|
|
<UserControl
|
2025-07-11 09:20:23 +08:00
|
|
|
d:DesignHeight="300"
|
|
|
|
|
d:DesignWidth="300"
|
|
|
|
|
mc:Ignorable="d"
|
2025-02-10 20:53:40 +08:00
|
|
|
x:Class="WPFluent.Controls.ImageView"
|
2025-07-11 09:20:23 +08:00
|
|
|
x:Name="ImagePanel"
|
2025-02-10 20:53:40 +08:00
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
|
xmlns:local="clr-namespace:WPFluent.Controls"
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
2025-07-11 09:20:23 +08:00
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-02-10 20:53:40 +08:00
|
|
|
<Grid>
|
2025-07-11 09:20:23 +08:00
|
|
|
<Rectangle RenderOptions.BitmapScalingMode="NearestNeighbor" Visibility="{Binding BackgroundVisibility, ElementName=ImagePanel}">
|
2025-02-10 20:53:40 +08:00
|
|
|
<Rectangle.Fill>
|
|
|
|
|
<ImageBrush
|
|
|
|
|
AlignmentY="Top"
|
|
|
|
|
ImageSource="{DynamicResource ImageViewerBackground}"
|
|
|
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"
|
|
|
|
|
Stretch="UniformToFill"
|
|
|
|
|
TileMode="Tile"
|
|
|
|
|
Viewport="0,0,32,32"
|
|
|
|
|
ViewportUnits="Absolute" />
|
|
|
|
|
</Rectangle.Fill>
|
|
|
|
|
</Rectangle>
|
|
|
|
|
<ScrollViewer
|
|
|
|
|
BorderThickness="0"
|
|
|
|
|
Focusable="False"
|
|
|
|
|
HorizontalScrollBarVisibility="Auto"
|
|
|
|
|
IsManipulationEnabled="True"
|
2025-07-11 09:20:23 +08:00
|
|
|
VerticalScrollBarVisibility="Auto"
|
|
|
|
|
x:Name="ViewPanel">
|
2025-02-10 20:53:40 +08:00
|
|
|
<local:AnimatedImage
|
2025-07-11 09:20:23 +08:00
|
|
|
AnimationUri="{Binding ImageUriSource, ElementName=ImagePanel}"
|
|
|
|
|
RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=ImagePanel}"
|
|
|
|
|
Stretch="None"
|
|
|
|
|
x:Name="ViewPanelImage" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</ScrollViewer>
|
|
|
|
|
<Border
|
|
|
|
|
Background="Gray"
|
|
|
|
|
CornerRadius="5"
|
2025-07-11 09:20:23 +08:00
|
|
|
HorizontalAlignment="Center"
|
2025-02-10 20:53:40 +08:00
|
|
|
IsHitTestVisible="False"
|
2025-07-11 09:20:23 +08:00
|
|
|
Opacity="0"
|
|
|
|
|
Padding="15,4,15,4"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
x:Name="ZoomLevelInfo">
|
2025-02-10 20:53:40 +08:00
|
|
|
<TextBlock
|
|
|
|
|
FontSize="18"
|
|
|
|
|
Foreground="White"
|
2025-07-11 09:20:23 +08:00
|
|
|
Text="{Binding ElementName=ImagePanel, Path=ZoomFactor, StringFormat={}{0:P0}}" />
|
2025-02-10 20:53:40 +08:00
|
|
|
<Border.Resources>
|
|
|
|
|
<Storyboard x:Key="StoryboardShowZoomLevelInfo">
|
2025-07-11 09:20:23 +08:00
|
|
|
<DoubleAnimationUsingKeyFrames Storyboard.Target="{Binding Source={x:Reference ZoomLevelInfo}}" Storyboard.TargetProperty="Opacity">
|
2025-02-10 20:53:40 +08:00
|
|
|
<DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
|
|
|
<LinearDoubleKeyFrame KeyTime="0:0:0.1" Value="0.9" />
|
|
|
|
|
<LinearDoubleKeyFrame KeyTime="0:0:0.6" Value="0.9" />
|
|
|
|
|
<LinearDoubleKeyFrame KeyTime="0:0:0.8" Value="0" />
|
|
|
|
|
</DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
|
|
|
</DoubleAnimationUsingKeyFrames>
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</Border.Resources>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</UserControl>
|