简体   繁体   中英

Reacting to scrolling in grouped GridView with SemanticZoom in Win8 XAML

I successfully created a parallax scrolling effect on the background on a grouped GridView , by wrapping it in a ScrollViewer and listening to the ScrollViewer.ViewChanged event. The problem is when this is mixed with a SemanticZoom .

Sample (stripped) XAML to show what I've done:

    <ScrollViewer>
        <SemanticZoom>
            <SemanticZoom.ZoomedInView>
                <GridView />
            </SemanticZoom.ZoomedInView>
            <SemanticZoom.ZoomedOutView>
                <GridView />
            </SemanticZoom.ZoomedOutView>
        </SemanticZoom>
    </ScrollViewer>

This allows me to move the background as the user scrolls. The problem is that SemanticZoom breaks: when you zoom out and select a group you're always taken to the first group. Removing ScrollViewer let's SemanticZoom work as intended, but then I can't get the scroll position (because GridView doesn't expose it).

Basically, I need to present grouped tiles with GridView + zoom semantically + move the background in a different speed than the scroll.

Is there a way to get the scroll position in GridView, or to make the above work?

Update: I was using C# and XAML in Win8 Consumer Preview, but prefer a solution for Release Preview.

SemanticZoom effectively works by cross-zooming and cross-fading two user controls (ZoomedInView and ZoomedOutView). I would recommend putting two ScrollViewers, one inside the ZoomedInView and one inside the ZoomedOutView. However, ScrollViewer doesn't implement the ISemanticZoomInfo interface that SemanticZoom needs.

You could look at subscribing to the ViewChanged event and changing something on the ScrollViewer when you're zoomed out. I was thinking about turning off IsHitTestVisible, but since the GridView is a child I think that would just disable everything. You could try turning off gesture events or ZoomChaining, but I don't know if that will fix the issue you're seeing. I agree with others that having an actual sample would help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM