locked
ScrollViewer.ViewChanged not rise

    Question

  • Hi All,

    I'm try to rise event ScrollViewer, but can't... :(

    i have XAML:

    <ScrollViewer ViewChanged="ScrollViewer_ViewChanged" ScrollViewer.HorizontalScrollMode="Enabled">
    <Grid>
    ...
    </Grid>
    </ScrollViewer>

    ScrollViewer_ViewChanged not rising... :( 

    Windows Phone 8.1

    Monday, October 20, 2014 9:22 PM

Answers

  • The ViewChanged should get hit when you try to scroll provided that the ScrollViewer actually contains any scrollable content. You may want to specify an explicit width or height for it depending on your requirements. Please refer to the following example:

    <ScrollViewer Height="100" Width="100" ViewChanged="ScrollViewer_ViewChanged" 
                          HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible">
                <Rectangle Height="500" Width="500" Fill="Green"/>
            </ScrollViewer>
    

    Monday, October 20, 2014 9:38 PM
  • Hi Alexey.U

    How i can emulate scroll whole page with scroll event?

    -> Use following code to scroll to a specific position.

     TimeSpan period = TimeSpan.FromMilliseconds(10);
    Windows.System.Threading.ThreadPoolTimer.CreateTimer(async (source) =>
                {
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                            scrollviewer.ChangeView(xPos,yPos,ratio);
                    });
                }
                , period);
    

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 27, 2014 7:16 AM
    Moderator

All replies

  • The ViewChanged should get hit when you try to scroll provided that the ScrollViewer actually contains any scrollable content. You may want to specify an explicit width or height for it depending on your requirements. Please refer to the following example:

    <ScrollViewer Height="100" Width="100" ViewChanged="ScrollViewer_ViewChanged" 
                          HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible">
                <Rectangle Height="500" Width="500" Fill="Green"/>
            </ScrollViewer>
    

    Monday, October 20, 2014 9:38 PM
  • Hm..

    How i can emulate scroll whole page with scroll event?

    I want to update Page.DateContext when page is "scroll" left.

    Monday, October 20, 2014 9:56 PM
  • Used FlipView with dynamic add items.. 
    • Marked as answer by Alexey.U Thursday, October 23, 2014 5:57 AM
    • Unmarked as answer by Alexey.U Thursday, October 23, 2014 5:57 AM
    Thursday, October 23, 2014 5:57 AM
  • Hi Alexey.U

    How i can emulate scroll whole page with scroll event?

    -> Use following code to scroll to a specific position.

     TimeSpan period = TimeSpan.FromMilliseconds(10);
    Windows.System.Threading.ThreadPoolTimer.CreateTimer(async (source) =>
                {
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                            scrollviewer.ChangeView(xPos,yPos,ratio);
                    });
                }
                , period);
    

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 27, 2014 7:16 AM
    Moderator