开发者

ScrollViewer won't scroll on empty parts of the Grid

开发者 https://www.devze.com 2023-03-09 19:37 出处:网络
I have a Grid with a ScrollViewer around it: <ScrollViewer> <Grid x:Name=\"MainGrid\"> <Grid.ColumnDefinitions>

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 text开发者_C百科blocks, 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?

0

精彩评论

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