Version 2.5.0
<Window x:Class="MagnifyingAdornerSample.MainWindow"
<Window x:Class="MagnifyingAdornerSample.MainWindow"
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:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:dc="clr-namespace:WPF.JoshSmith.Controls"
xmlns:local="clr-namespace:MagnifyingAdornerSample"
mc:Ignorable="d"
Title="MainWindow"
MinHeight="600"
MinWidth="800"
Height="{Binding Source={x:Static SystemParameters.FullPrimaryScreenHeight}}"
Width="{Binding Source={x:Static SystemParameters.FullPrimaryScreenWidth}}"
WindowStartupLocation="CenterScreen" >
<Window.Resources>
<Storyboard x:Key="MarchingAnts">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="selectionRectangle"
Storyboard.TargetProperty="(Shape.StrokeDashOffset)"
RepeatBehavior="Forever">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="10"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource MarchingAnts}"/>
</EventTrigger>
</Window.Triggers>
<Grid
x:Name="findPlateView"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="9*" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<xctk:Zoombox x:Name="imgZoomBox" MinScale="0.5" MaxScale="125" Style="{StaticResource myzoom}">
<Grid Width="{Binding Source={x:Static SystemParameters.FullPrimaryScreenWidth}}" Height="{Binding Source={x:Static SystemParameters.FullPrimaryScreenHeight}}" Background="Transparent">
<!-- Image with DragCanvas -->
<!-- The Drag Canvas is stretched to fill its content therefore by sizing it to match the image in code the selection box gets clipped to image size -->
<Image
x:Name="findPlateImage" Source="/Shared/sample.jpg"
Margin="5" SizeChanged="findPlateImage_SizeChanged"/>
<dc:DragCanvas x:Name="BackPanel" SizeChanged="BackPanel_SizeChanged" Background="Transparent" Visibility="Visible">
<Rectangle x:Name="selectionRectangle" Width="250" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Stroke" Value="#FFFFFF"/>
<Setter Property="StrokeDashArray" Value="5"/>
<Setter Property="StrokeDashOffset" Value="0"/>
<Setter Property="StrokeThickness" Value="3"/>
<Setter Property="Fill" Value="#14FFFFFF" />
<!-- <Setter Property="Fill" Value="Yellow"/>
<Setter Property="Opacity" Value="0.2"/> -->
</Style>
</Rectangle.Style>
</Rectangle>
</dc:DragCanvas>
</Grid>
</xctk:Zoombox>
</Grid>
</Window>