简单的问题:如何让网格使用滚动条? [英] Simple question: how can I get a grid to use a scrollbar?

查看:97
本文介绍了简单的问题:如何让网格使用滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能令人难以置信的简单:我正在尝试创建一个画布或网格,如果大于实际屏幕,它将允许您向下/向右滚动,如果您愿意的话。我试过简单地将一个滚动条控件应用到
一个网格/画布上,它的内容比屏幕上的更多,并且它无法正常工作。有什么建议吗?

This question may be mind-bogglingly simple: I'm trying to create either a canvas or grid that, if bigger than the actual screen its on, will allow you to scroll down/to the right if you so wish. I tried simply applying a scrollbar control to a grid/canvas that had more on it than could fit on the screen, and it didn't function properly. Any suggestions?

推荐答案

您是否尝试过在滚动查看器中包装网格?

Have you tried wrapping your grid in a scroll viewer?

网格和画布两者在Blend中为滚动条显示属性,但它们不起作用。

The grid and canvas both show properties in Blend for a scroll bar, but they don't work.

~Christine

~Christine

<ScrollViewer x:Name="myScrollViewer" HorizontalAlignment="Left" Margin="272,316,0,304" Width="100" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" >
			<Grid x:Name="myReallyLargeGrid" Height="500" Width="500">
				<Grid.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="Black" Offset="0"/>
						<GradientStop Color="White" Offset="1"/>
					</LinearGradientBrush>
				</Grid.Background>
			</Grid>
		</ScrollViewer>

 

将ScrollViewer上的滚动条设置为"自动"只有当你的网格比观众大时才会显示它们。

Setting the scroll bars on the ScrollViewer to "Auto" will have them only show up if your grid is larger than the viewer.


这篇关于简单的问题:如何让网格使用滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆