如何在一个页面中对齐两个滚动查看器 [英] How to align two scroll viewers in one page
问题描述
我试图在一个页面中将父滚动查看器中的2个滚动查看器对齐。
I am trying to allign 2 scrollviewers inside a parent scrollviewer in one page.
每个scrollviewer里面是一个动态添加数据的列表框。但是ScrollViewer(DataViewer1)占据了整个页面,即使我将空格分割为 1.5 * for
" DatavIiewer1"和 1 * 用于"DataViewer"。
Inside each scrollviewer is a listbox in which data is added dynamically.But the ScrollViewer (DataViewer1) is occupying the whole page even when I have divided the space with 1.5* for "DatavIiewer1" and 1* for "DataViewer".
<ScrollViewer Name="DataList" Grid.Row="2" Grid.RowSpan="2" Grid.Column="1" VerticalAlignment="Stretch">
<Grid Name="ScrollContent" Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ScrollViewer Grid.Row="0" Grid.Column="0" Name="DataViewer1" VerticalScrollBarVisibility="Visible">
------//Dynamic Listbox
</ScrollViewer>
<Grid Grid.Row="1" Grid.Column="0" Name="DataViewer" >
<ScrollViewer>
---------//Dynamic Listbox
</Scrollviewer>
</Grid>
</Grid>
</ScrollViewer>
Windows中是否存在以上功能限制?
Is there a limitation in Windows for above functionality?
当我设置Grid"ScrollContent"Height = 1000时,上面的代码正常工作。但是我希望它能够响应。
The above code is working when I am setting the Grid "ScrollContent" Height=1000. But I want it to be responsive.
推荐答案
你好,
请阅读粘贴帖子,特别是 发布指南:主题行
标签,不要忘记在你的问题中添加标签。
Please read the sticky posts, especially the Guide to posting: subject line tags, and don't forget add tag to your question.
问题是你把Grid放在ScrollViewer中我不明白为什么你这样做。对于修复问题,只需删除DataList
The problem is that you put Grid in ScrollViewer I don't understand why you do that. For fix issue just remove DataList
这篇关于如何在一个页面中对齐两个滚动查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!