在GridView的C#的ScrollViewer水平偏移 [英] horizontal offset for scrollviewer in gridview C#

查看:468
本文介绍了在GridView的C#的ScrollViewer水平偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用的是Windows 8发布预览和C#(VS 2012)的地铁应用,有什么办法通过提供HorizantalOffset滚动网格视图水平滚动条。
简介:在滚动浏览器类,我们可以移动水平滚动条和垂直滚动条动态使用 ScrollToHorizo​​ntalOffset ScrollToVerticalOffset ,但在GridView的我不觉得那些属性,那么我如何才能通过代码动态滚动?或者我得到参考gridview的滚动条?任何一个可以帮助我,在此先感谢

I'm developing metro app using Windows 8 release preview and C#(VS 2012), Is there any way to scroll grid view horizontal scroll bar by providing HorizantalOffset. Brief: In scroll-viewer class we can move horizontal scroll bar and vertical scroll bar dynamically using ScrollToHorizontalOffset and ScrollToVerticalOffset,But in gridview I don't find those properties, So how can I scroll dynamically by code? or can i get reference to scrollbar in gridview ? Can any one help me with this, Thanks in advance

推荐答案

您可以使用VisualTreeHelper GridView的模板参考的ScrollViewer 。你也可以用一些辅助的方法,我把的WinRT XAML工具包 - 中的 VisualTreeHelperExtensions 的。你只需要在使用WinRTXamlToolkit.Extensions

You can get the reference to the ScrollViewer from the GridView's template using VisualTreeHelper. You can also use some helper methods I put in WinRT XAML Toolkit - in VisualTreeHelperExtensions. You would just need to add

using WinRTXamlToolkit.Extensions;



然后调用

then call

var scrollViewer = myGridView.GetFirstDescendantOfType<ScrollViewer>()

和你去。

编辑* - 注意命名空间中的工具包WinRTXamlToolkit.Controls.Extensions更高版本已经改变了

EDIT* - note the namespace has changed in later versions of the toolkit to WinRTXamlToolkit.Controls.Extensions.

这篇关于在GridView的C#的ScrollViewer水平偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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