tr4np
Topic Author
Posts: 17
Joined: 26 Aug 2014, 15:33

ScrollViewer scrollbars not hiding/showing

05 Jun 2015, 00:44

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.
 
User avatar
sfernandez
Site Admin
Posts: 1974
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer scrollbars not hiding/showing

05 Jun 2015, 12:43

Ok, I was able to reproduce it here.
I will take a look and fix it as soon as possible.
 
User avatar
sfernandez
Site Admin
Posts: 1974
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer scrollbars not hiding/showing

08 Jul 2015, 13:47

We fixed this issue for the upcoming 1.2.4 release.

Who is online

Users browsing this forum: asusralis and 10 guests