Markus Hütter
Markus Hütter

Reputation: 7906

WinRT ScrollViewer Zoom Bug?

I am having issues with WinRt's ScrollViewer. Consider this minimal sample:

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
    <TextBlock Width="50" TextWrapping="Wrap">
        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
    </TextBlock>
</ScrollViewer>

Zooming in just a little will cut off the text at the top. You can't actually scroll that part into view anymore. Changing the HorizontalScrollBarVisibility to Visible also doesn't work.

Am I missing something or is this truly a bug?

EDIT: Can at least someone confirm this?

Upvotes: 2

Views: 200

Answers (1)

CarCar
CarCar

Reputation: 680

The problem is you're not specifying the Height of the TextBlock. I agree -- it shouldn't work this way but it does at the moment. There are workarounds. For example: Modify TextBlock tag as follows:

<TextBlock TextWrapping="Wrap" Width="50" VerticalAlignment="Top">

You can add a grid around the TextBlock and set the background color of the scrollview and grid to see whats going on:

    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="Red">
        <Grid Width="50" Background="Green" VerticalAlignment="Top">
            <TextBlock TextWrapping="Wrap" Width="50">
                Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
            </TextBlock>
        </Grid>
    </ScrollViewer>

Upvotes: 1

Related Questions