设置GridView控件的Scrollviewer位置

时间:2015-10-19 14:49:01

标签: c# wpf gridview winrt-xaml

我正在开发一个Windows通用应用程序,我在Xaml中有这个GridView:

<Grid Grid.Column="1"  Height="700" VerticalAlignment="Bottom" Name="GridPoints" Margin="0,0,0,0">
            <GridView x:Name="GridViewList"  ItemsSource="{Binding Points}" ItemClick="GridView_ItemClick"  IsItemClickEnabled="True"
                       ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                      ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Disabled"
                      ItemContainerStyle="{Binding Source={StaticResource GridViewItemContainer}}" SelectedItem="{Binding SlectedPoint, Mode=TwoWay}"  >
                <GridView.ItemTemplate>...etc...

我需要更改滚动查看器的位置,以便在绑定列表中显示我选定的点上的焦点。

1 个答案:

答案 0 :(得分:0)

也许您正在寻找:

ScrollViewer.ScrollToVerticalOffset(double);

https://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.scrolltoverticaloffset(v=vs.110).aspx

希望这有帮助!