JD2022-TU1/main/tools/modules/Orbit.Module/View/ImageViewer.xaml

74 lines
3.9 KiB
XML

<Window x:Class="Orbit.Module.View.ImageViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Orbit.Module.View"
mc:Ignorable="d"
WindowStyle="None"
WindowStartupLocation="CenterOwner"
Loaded="ImageViewer_OnLoaded">
<Window.CommandBindings>
<CommandBinding Command="Close" Executed="OnCloseExecuted"/>
<CommandBinding Command="Properties" Executed="OnShowInfoExecuted"/>
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Key="Right" Command="{Binding CommandRight}"/>
<KeyBinding Key="Left" Command="{Binding CommandLeft}"/>
<KeyBinding Key="Up" Command="{Binding CommandUp}"/>
<KeyBinding Key="Down" Command="{Binding CommandDown}"/>
<KeyBinding Key="Escape" Command="Close"/>
<KeyBinding Key="Space" Command="Close"/>
<KeyBinding Key="I" Command="Properties"/>
<KeyBinding Key="F" Command="{Binding CommandToggleFitToScreen}"/>
</Window.InputBindings>
<Grid Background="Black" x:Name="grid">
<local:CustomScrollViewer HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden" x:Name="tata">
<local:CustomScrollViewer.InputBindings>
<KeyBinding Key="F" Command="{Binding CommandToggleFitToScreen}"/>
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding CommandToggleFitToScreen}"/>
</local:CustomScrollViewer.InputBindings>
<Image HorizontalAlignment="Center" VerticalAlignment="Center"
x:Name="Image"
Source="{Binding ImageSource}"
Stretch="{Binding ImageStretch}"
StretchDirection="DownOnly"
RenderOptions.BitmapScalingMode="Fant">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLoading}" Value="True">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
<DataTrigger Binding="{Binding Stretch, ElementName=Image}" Value="Uniform">
<Setter Property="Height" Value="{Binding ActualHeight, ElementName=grid}"/>
<Setter Property="Width" Value="{Binding ActualWidth, ElementName=grid}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</local:CustomScrollViewer>
<TextBlock x:Name="_infos" IsHitTestVisible="False" Margin="20 20 0 0" Foreground="White" FontSize="20">
<Run Text="{Binding Title}"/>
<LineBreak/>
<Run>
<Run.Style>
<Style TargetType="Run">
<Setter Property="Text" Value="Fullsize"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Stretch, ElementName=Image}" Value="Uniform">
<Setter Property="Text" Value="Fit To Screen"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Run.Style>
</Run>
</TextBlock>
<TextBlock IsHitTestVisible="False" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding ErrorText}" Foreground="White" FontSize="20"/>
</Grid>
</Window>