简体   繁体   中英

ScrollViewer won't scroll on empty parts of the Grid

I have a Grid with a ScrollViewer around it:

<ScrollViewer>
    <Grid x:Name="MainGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
    </Grid>
</ScrollViewer>

I the code-behind I fill this Grid with a dynamic amount of RowDefinitions . In the first column, I always put a TextBlock displaying a certain time of day (08:00, 08:10, ...):

http://www.youth-area.ch/users/finnland/times.png

My problem now is the scolling. When I mousescroll with my cursor over the textblocks , it scrolls without a problem . But when I place my cursoer over the empty part of the grid (right side), it won't scroll .

How do I fix that?

I think you might just have to set a background on your Grid?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM