首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WPF/Silverlight:防止ScrollBars上的ScaleTransform

WPF/Silverlight:防止ScrollBars上的ScaleTransform
EN

Stack Overflow用户
提问于 2011-05-13 00:16:19
回答 2查看 645关注 0票数 2

我想知道是否有一种方法可以将ScaleTransform应用于ScrollViewer,并且不允许缩放滚动条。

这是我尝试过的:

代码语言:javascript
复制
<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似乎不能正常工作。有什么想法吗?

提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-06-23 03:21:12

似乎没有办法做我想要的事情。如果我遇到合适的方法,我会更新这个答案。

票数 1
EN

Stack Overflow用户

发布于 2011-05-13 00:33:35

为什么不把你的ScaleTransform添加到ScrollViewer的内容中而不是ScrollViewer中呢?

代码语言:javascript
复制
<ScrollViewer>
    <ContentControl /> <!-- Apply ScaleTransform to this -->
</ScrollViewer>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5981097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档