开发者

WPF/Silverlight: Prevent ScaleTransform on ScrollBars

I'm wondering if there's a way to apply a ScaleTransform to a ScrollViewer and not allow the scrollbars to be scaled.

Here's what I've tried:

<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>
    &开发者_如何学Clt;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>

The ScrollBarTransform doesn't seem to stick when moving the slider back and forth. Any thoughts?

Thanks in advance.


It appears there isn't a way to do what I'm looking for. If I ever come across the proper method I will update this answer.


Why not add your ScaleTransform to the ScrollViewer's content instead of the ScrollViewer?

<ScrollViewer>
    <ContentControl /> <!-- Apply ScaleTransform to this -->
</ScrollViewer>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜