这不是一个简单的滚动问题
假设我的窗口中有一些标题元素和一些内容元素。我需要标题元素与内容元素一起水平滚动。但是,当垂直滚动时,第一个应该保持冻结状态,而第二个应该正常滚动。 我该怎么做?
我尝试了以下代码
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden">
<DockPanel LastChildFill="True">
<MyHeader DockPanel.Dock="Top"/>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
<StackPanel>
<MyContent />
</StackPanel>
</ScrollViewer>
</DockPanel>
</ScrollViewer>
,但似乎滚动视图的属性是继承的,所以这不起作用。
Suppose I have some header element and some content element in my window. I need the header element to horizontally scroll together with the content element. But when scrolling vertically the first should stay frozen while the second should scroll normally.
How can I do this?
I tried the following code
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden">
<DockPanel LastChildFill="True">
<MyHeader DockPanel.Dock="Top"/>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
<StackPanel>
<MyContent />
</StackPanel>
</ScrollViewer>
</DockPanel>
</ScrollViewer>
But it seems the scrollviewwer's properties are inherited so this doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论