Files
Shrlalgo.RvKits/WPFluent/Controls/ImageView/ImageView.xaml

65 lines
2.8 KiB
Plaintext
Raw Normal View History

<UserControl
2025-07-11 09:20:23 +08:00
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d"
x:Class="WPFluent.Controls.ImageView"
2025-07-11 09:20:23 +08:00
x:Name="ImagePanel"
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">
<Grid>
2025-07-11 09:20:23 +08:00
<Rectangle RenderOptions.BitmapScalingMode="NearestNeighbor" Visibility="{Binding BackgroundVisibility, ElementName=ImagePanel}">
<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">
<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" />
</ScrollViewer>
<Border
Background="Gray"
CornerRadius="5"
2025-07-11 09:20:23 +08:00
HorizontalAlignment="Center"
IsHitTestVisible="False"
2025-07-11 09:20:23 +08:00
Opacity="0"
Padding="15,4,15,4"
VerticalAlignment="Center"
x:Name="ZoomLevelInfo">
<TextBlock
FontSize="18"
Foreground="White"
2025-07-11 09:20:23 +08:00
Text="{Binding ElementName=ImagePanel, Path=ZoomFactor, StringFormat={}{0:P0}}" />
<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">
<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>