<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:local="clr-namespace:Bro.Common.ImageCanvas">
|
|
<!--
|
Default style and template for the ZoomAndPanControl.
|
-->
|
<Style TargetType="{x:Type local:ZoomAndPanControl}">
|
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="Background" Value="#80C0C0C0" />
|
<Setter Property="BorderBrush" Value="Black" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type local:ZoomAndPanControl}">
|
<Grid>
|
<Border Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|
<!--
|
The ContentPresenter is used to scale and offset the content of ZoomAndPanControl.
|
|
A transforms computed from 'ViewportZoom', 'ContentOffsetX' and 'ContentOffsetY' are assigned
|
to the 'RenderTransform' property in OnApplyTemplate in ZoomAndPanControl.cs.
|
|
The alignment is set to top-left. This allows the content offset to be used to place
|
the content in the center of the viewport when the viewport is bigger than the content.
|
-->
|
<ContentPresenter x:Name="PART_Content"
|
HorizontalAlignment="Left"
|
VerticalAlignment="Top" />
|
|
</Border>
|
|
<Canvas x:Name="PART_DragZoomCanvas"
|
HorizontalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
Visibility="Collapsed">
|
<Border x:Name="PART_DragZoomBorder"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
CornerRadius="1" />
|
</Canvas>
|
</Grid>
|
</ControlTemplate>
|
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style TargetType="{x:Type local:ZoomAndPanScrollViewer}">
|
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="Background" Value="#80C0C0C0" />
|
<Setter Property="BorderBrush" Value="Black" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type local:ZoomAndPanScrollViewer}">
|
<ScrollViewer x:Name="PART_ZoomAndPanScrollViewer"
|
CanContentScroll="True"
|
HorizontalScrollBarVisibility="Auto"
|
VerticalScrollBarVisibility="Auto">
|
<local:ZoomAndPanControl x:Name="PART_ZoomAndPanControl"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
MinimumZoomType="{TemplateBinding MinimumZoomType}"
|
MousePosition="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWayToSource, Path=MousePosition}"
|
UseAnimations="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Path=UseAnimations}"
|
ViewportZoom="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=ViewportZoom}"
|
ZoomAndPanInitialPosition="{TemplateBinding ZoomAndPanInitialPosition}">
|
<ContentPresenter HorizontalAlignment="Left"
|
VerticalAlignment="Top"
|
Content="{TemplateBinding Content}" />
|
|
</local:ZoomAndPanControl>
|
</ScrollViewer>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<!--
|
Default style and template for the ZoomAndPanViewBox.
|
-->
|
<Style TargetType="{x:Type local:ZoomAndPanViewBox}">
|
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="Background" Value="#80C0C0C0" />
|
<Setter Property="BorderBrush" Value="Black" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type local:ZoomAndPanViewBox}">
|
<Viewbox>
|
<Canvas Name="PART_Content"
|
Width="{Binding Path=Content.ActualWidth}"
|
Height="{Binding Path=Content.ActualHeight}">
|
<Border Name="PART_DraggingBorder"
|
Canvas.Left="{Binding Path=ZoomAndPanContent.ContentOffsetX, Mode=TwoWay}"
|
Canvas.Top="{Binding Path=ZoomAndPanContent.ContentOffsetY, Mode=TwoWay}"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="10"
|
CornerRadius="1">
|
<Border.Width>
|
<MultiBinding Converter="{local:ZoomAndPanViewBoxClampConverter}" ConverterParameter="width">
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ContentViewportWidth" />
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ContentOffsetX" />
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ViewportZoom" />
|
<Binding Path="ZoomAndPanContent" />
|
</MultiBinding>
|
</Border.Width>
|
<Border.Height>
|
<MultiBinding Converter="{local:ZoomAndPanViewBoxClampConverter}" ConverterParameter="height">
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ContentViewportHeight" />
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ContentOffsetY" />
|
<Binding Mode="OneWay" Path="ZoomAndPanContent.ViewportZoom" />
|
<Binding Path="ZoomAndPanContent" />
|
</MultiBinding>
|
</Border.Height>
|
</Border>
|
<Border Name="PART_SizingBorder"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="10"
|
CornerRadius="1"
|
Visibility="Hidden" />
|
</Canvas>
|
</Viewbox>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</ResourceDictionary>
|