Question

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 not visible anymore ?

Thanks in advance Daniel

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top