views:

36

answers:

1

hi guys,

I need a zooming mechanism. So I found one on http://stackoverflow.com/questions/850554/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

A: 

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>
Wallstreet Programmer