-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScrollViewer.xaml
37 lines (36 loc) · 1.81 KB
/
ScrollViewer.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<UserControl x:Class="LungMorphApp.ScrollViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:LungMorphApp"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<local:SliderToZoomConverter x:Key="SliderToZoom"/>
</UserControl.Resources>
<Grid>
<ScrollViewer Name="scrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True"
ScrollChanged="OnScrollViewerScrollChanged"
MouseLeftButtonUp="OnMouseLeftButtonUp"
PreviewMouseLeftButtonUp="OnMouseLeftButtonUp"
PreviewMouseLeftButtonDown="OnMouseLeftButtonDown"
PreviewMouseWheel="OnPreviewMouseWheel"
MouseMove="OnMouseMove">
<Grid x:Name="myCanvas" RenderTransformOrigin="0.5,0.5">
<Grid.LayoutTransform>
<TransformGroup>
<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
</TransformGroup>
</Grid.LayoutTransform>
<Image x:Name="Image" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
</ScrollViewer>
<StackPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Opacity="0.90" Height="24">
<TextBox IsReadOnly="True" DockPanel.Dock="Left" Text="{Binding ElementName=slider, Path=Value, Converter={StaticResource SliderToZoom}, StringFormat={}{0:P0}}" Margin="4,0"/>
<Slider x:Name="slider" DockPanel.Dock="Left" Orientation="Horizontal" Width="120" Minimum="-5" Maximum="3" Value="0" IsSnapToTickEnabled="True" TickFrequency="0.5" VerticalAlignment="Center" ValueChanged="OnSliderValueChanged"/>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>