2017-10-16 64 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獲得它。 –