我想知道是否有一种方法可以将ScaleTransform应用于ScrollViewer,并且不允许缩放滚动条。
这是我尝试过的:
<Window x:Class="Zoom.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<ScaleTransform x:Key="ScrollBarTransform" ScaleX="1.0" ScaleY="1.0" />
<Style TargetType="ScrollBar">
<Setter Property="LayoutTransform" Value="{StaticResource ScrollBarTransform}" />
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0">
<ScrollViewer.LayoutTransform>
<ScaleTransform ScaleX="{Binding ElementName=scaleSlider, Path=Value}"
ScaleY="{Binding ElementName=scaleSlider, Path=Value}" />
</ScrollViewer.LayoutTransform>
</ScrollViewer>
<Slider Grid.Row="1" Name="scaleSlider" Value="1" Minimum="0.5" Maximum="5.0" TickFrequency="0.25" />
</Grid>
来回移动滑块时,ScrollBarTransform似乎不能正常工作。有什么想法吗?
提前谢谢。
发布于 2011-06-23 03:21:12
似乎没有办法做我想要的事情。如果我遇到合适的方法,我会更新这个答案。
发布于 2011-05-13 00:33:35
为什么不把你的ScaleTransform添加到ScrollViewer的内容中而不是ScrollViewer中呢?
<ScrollViewer>
<ContentControl /> <!-- Apply ScaleTransform to this -->
</ScrollViewer>https://stackoverflow.com/questions/5981097
复制相似问题