开发者

How can I scroll on scaled control?

开发者 https://www.devze.com 2022-12-20 05:26 出处:网络
I need a zooming mechanism. So I found one on Zoom control to WPF Form which seem to be suitable for me.

I need a zooming mechanism. So I found one on Zoom control to WPF Form which seem to be suitable for me. I have made a slider and apply ScaleTransform.

My questions is: Is there any way I can wrap this into a scroll viewer so that I could scroll to the enlarged part that is 开发者_StackOverflow中文版not visible anymore ?

Thanks in advance Daniel


Yes, you can wrap anything in a scrollviewer.

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="30" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="100" />
    </Grid.ColumnDefinitions>
    <Slider Grid.Row="0" Grid.Column="0" x:Name="slider" Minimum="1" Maximum="10" />
    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
        <TextBlock Grid.Column="0" Text="1234567890" Background="Yellow">
            <TextBlock.LayoutTransform>
                <ScaleTransform ScaleX="{Binding Path=Value, ElementName=slider}" ScaleY="{Binding Path=Value, ElementName=slider}" />
          </TextBlock.LayoutTransform>
        </TextBlock>
    </ScrollViewer>
</Grid>
0

精彩评论

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