Page 1 of 1

ScrollViewer scrollbars not hiding/showing

Posted: 05 Jun 2015, 00:44
by tr4np
I have an Image inside a ScrollViewer. The XAML has both the horizontal and vertical scrollbar visibility set to Auto. The initial Image is initially sized to the exact dimensions of the ScrollViewer. The initial view shows the entire image without any scrollbars. When I enlarge the Image, scrollbars appear, as expected. However, when I reset the size back to the initial dimensions, the scrollbars do not go away.

I tried to force the display of the scrollbars, but the methods for changing the scrollbar visibility do not seem to work. Here is my code:
    void buttonDebugZoom_Click(object sender, RoutedEventArgs e)
    {
        Debug.Log("+buttonDebugZoom_Click");
        fDebugZoom = !fDebugZoom;
        if (fDebugZoom)
        {
            Debug.Log("  zoomed in");
            imgDebug.Width = cachedImageData.width/2;
            imgDebug.Height = cachedImageData.height/2;

            ScrollViewer.SetHorizontalScrollBarVisibility(svDebug, ScrollBarVisibility.Visible);
            ScrollViewer.SetVerticalScrollBarVisibility(svDebug, ScrollBarVisibility.Visible);

            buttonDebugZoom.Content = "Zoom -";
        }
        else
        {
            Debug.Log("  zoomed out");
            imgDebug.Width = svDebug.ActualWidth;
            imgDebug.Height = svDebug.ActualHeight;

            ScrollViewer.SetHorizontalScrollBarVisibility(svDebug, ScrollBarVisibility.Disabled);
            ScrollViewer.SetVerticalScrollBarVisibility(svDebug, ScrollBarVisibility.Disabled);

            buttonDebugZoom.Content = "Zoom +";
        }
    }
I've also tried ScrollBarVisibility.Hidden, but that doesn't work, either.

I'm using v1.2.3 in Unity 5, running on Windows 8.1.

Re: ScrollViewer scrollbars not hiding/showing

Posted: 05 Jun 2015, 12:43
by sfernandez
Ok, I was able to reproduce it here.
I will take a look and fix it as soon as possible.

Re: ScrollViewer scrollbars not hiding/showing

Posted: 08 Jul 2015, 13:47
by sfernandez
We fixed this issue for the upcoming 1.2.4 release.