This repository has been archived on 2024-06-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
thesis-src/Examples/GUI/Controls/ImageControl.xaml
2023-08-10 09:04:36 +02:00

34 lines
1.5 KiB
XML

<UserControl
x:Class="GUI.Controls.ImageControl"
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:converters="clr-namespace:GUI.Converters"
xmlns:controls="clr-namespace:GUI.Controls"
d:DataContext="{d:DesignInstance controls:ImageControl}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<converters:ImageConverter x:Key="Converter.CImage" />
<ControlTemplate x:Key="ControlTemplate.ImageControl.Default" TargetType="controls:ImageControl">
<Border DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Padding="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Image RenderOptions.BitmapScalingMode="NearestNeighbor"
Stretch="Uniform"
Source="{Binding Image, Converter={StaticResource Converter.CImage}}" />
</Border>
</ControlTemplate>
<Style x:Key="Style.ImageControl.Default" TargetType="controls:ImageControl">
<Setter Property="Template" Value="{StaticResource ControlTemplate.ImageControl.Default}" />
</Style>
<Style BasedOn="{StaticResource Style.ImageControl.Default}" TargetType="controls:ImageControl" />
</UserControl.Resources>
<Grid />
</UserControl>