locked
Turn off FlipViewer controls? RRS feed

  • Question

  • I have a scroll viewer containing an image inside a flip view.  When the user is zoomed out I want the flip view controls to be available and for the user to be able to drag left and right to change pictures.  However, when the scroll viewer is not at MinZoomFactor, I want the flip view controls to be hidden and for it to let the scroll viewer handle the drag.  This is the same as images work in the pictures application on the phone.  But I can't see any way to tell the flip view to play nicely with the scroll viewer and hide its own controls.  How can I do this?

    ...Stefan

    Saturday, May 26, 2012 1:28 AM

Answers

  • Hi Stefan,

    You can walk up the visual tree until you find the FlipView's ScrollViewer and set its HorizontalScrollingMode to None when you want to allow zooming. That will allow your child code to take over the manipulations without the ScrollViewer interfering. You may also need to fiddle with the template some to hide the scrolling controls.

    --Rob

    • Marked as answer by StefanOlson Saturday, February 23, 2013 7:13 AM
    Saturday, February 23, 2013 6:36 AM
    Moderator

All replies

  • Checking this out...


    --------------------------------------------------------------------------------

    Alejandro Campos Magencio - Microsoft Escalation Engineer - Forum Moderator
     If my reply answers your question, please mark this post as answered.

    Wednesday, May 30, 2012 3:37 PM
    Moderator
  • Hi,

    I created a sample that may help you on this, as it disables de flip view when zoom factor is greater than MinZoomFactor.

    The XAML:

    <Page
        x:Class="FlipViewTest.BlankPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:FlipViewTest"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
                <ScrollViewer x:Name="myScrollViewer" MinZoomFactor="1" HorizontalScrollBarVisibility="Auto">
                    <FlipView x:Name="myFlipView" HorizontalAlignment="Center" VerticalAlignment="Center" LayoutUpdated="myFlipView_LayoutUpdated" >
                        <FlipViewItem>
                            <Image Source="Assets/1.jpg"/>
                        </FlipViewItem>
                        <FlipViewItem>
                            <Image Source="Assets/2.jpg"/>
                        </FlipViewItem>
                        <FlipViewItem>
                            <Image Source="Assets/3.jpg"/>
                        </FlipViewItem>
                        <FlipViewItem>
                            <Image Source="Assets/4.jpg"/>
                        </FlipViewItem>
                        <FlipViewItem>
                            <Image Source="Assets/5.jpg"/>
                        </FlipViewItem>
                    </FlipView>
                </ScrollViewer>
    
        </Grid>
    </Page>
    

    And the code behind:

            private void myFlipView_LayoutUpdated(object sender, object e)
            {
                if (myScrollViewer.ZoomFactor > myScrollViewer.MinZoomFactor + 0.01)
                {
                    myFlipView.IsEnabled = false;
                }
                else
                {
                    myFlipView.IsEnabled = true;
                }
            }


    --------------------------------------------------------------------------------

    Alejandro Campos Magencio - Microsoft Escalation Engineer - Forum Moderator
     If my reply answers your question, please mark this post as answered.

    Thursday, May 31, 2012 12:48 PM
    Moderator
  • Alejandro,

    Thanks for your reply.   Unfortunately as I described in my a message at the beginning I have the scrollviewer containing the image inside the flip view.  The code you have posted has the scrollviewer outside the flipview.  If I follow your suggestion of making IsEnabled false - it does partially what I want in that the flip view controls disappear, but then I can't interact with the scroll viewer contained within the flipviewer.

    So I'm back to square one, how do I hide/disable the flip view controls whilst still interacting with the scroll viewer?

    ...Stefan

    Tuesday, June 12, 2012 9:48 PM
  • Any solutions for this?

    ...Stefan

    Monday, June 25, 2012 12:29 AM
  • This is now a problem in another project of mine.  What can we do to allow zooming inside a flip view?
    Friday, February 22, 2013 11:13 PM
  • Hi Stefan,

    You can walk up the visual tree until you find the FlipView's ScrollViewer and set its HorizontalScrollingMode to None when you want to allow zooming. That will allow your child code to take over the manipulations without the ScrollViewer interfering. You may also need to fiddle with the template some to hide the scrolling controls.

    --Rob

    • Marked as answer by StefanOlson Saturday, February 23, 2013 7:13 AM
    Saturday, February 23, 2013 6:36 AM
    Moderator
  • Thanks Rob I have come to the same conclusion this afternoon myself.  It works on my test application, but in my actual application the whole thing just crashes with no exceptions, no errors just disappears :-)  Whether it relates to the setting of the horizontal scroll mode or not I don't yet know, it just crashes when I start zooming.  What is the best way to report that sort of crash?  Presumably, even if I am doing something wrong that shouldn't just crash in that way?

    Stefan

    Saturday, February 23, 2013 7:44 AM