2017-10-16 71 views
0

是否可以在SemanticZoom中滚动到视图中? SemanticZoom没有ScrollIntoView方法(与ListView相反)。所以当SemanticView放大时,我无法缩放到一个组元素。我试图通过恢复的ScrollViewer这样做:SemanticZoom中的UWP ScrollIntoView

var root = VisualTreeHelper.GetChild(semanticView, 0); 
var scrollviewer = VisualTreeHelper.GetChild(root, 0) as ScrollViewer; 

...但我不能够得到目标元素的UIElement。

回答

0

我终于成功地回收包含在我的GridView ZoomedInView。实际上,我在这个GridView中使用了CollectionViewSource。而且它恰好也可以滚动到一个组,而不仅仅是一个我不知道的项目。

1

要同步ZoomedInViewZoomedOutView您可以使用下面的代码

private void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e) 
{ 
    if (e.IsSourceZoomedInView == false) 
    { 
     e.DestinationItem.Item = e.SourceItem.Item; 
    } 
} 

如果要滚动其他一些时间,然后用下面的代码

var zoomLoc = new SemanticZoomLocation() { Item = /* Item to navigate */}; 
mySemanticZoom.ZoomedInView.MakeVisible(zoomLoc); 
+0

正如我所说,我没有检索scrollviewer的问题。另一方面,我不能从其索引上滚动一个元素。请注意,我正试图在放大的SemanticZoom控件中执行此操作。 –

+0

@SamuelLIOULT我已更新我的答案 –

+0

问题是SemanticZoom不包含作为ListViewBase的ContainerFromIndex方法。当它的IsZoomedInViewActive属性值为true时,我无法通过SemanticZoom获得它。 –