0

I have a scrollviewer in which I have 2 WrapPanels. I would like to know how I would go about getting the scroll viewer position once a user scrolled to the last end of the last panel. I am trying to show and hide an on screen arrow that indicates there is more content, but off to the right of the screen, but I would like to hide the button once they get to the end of the scroll viewer.

Can someone point me in the direction of what I would do in the code behind to get the horizontal offset position of the scrollviewer based on the panning. Mainly I want to get the far right position and hide the Arrow button when it gets to that point. My width for each Panel is currently 1920, so the window is currently 1920 width which hides the next panel in the Stack.

My XAML currently is below:

<ScrollViewer x:Name="scrVwrProductCategories" Style="{DynamicResource scrVwrFullWidthHorizontal}" PanningMode="HorizontalOnly" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled">
    <StackPanel Width="Auto" Height="750" HorizontalAlignment="Right" Orientation="Horizontal">
        <WrapPanel Style="{DynamicResource wrpPnlProductCategoriesPanels}" x:Name="wrpPnlProductCategories">
            <!-- Constant currently for count of buttons per WrapPanel = 6-->
            <!-- This is filled in dynamically at runtime
        <controls:btnLarge Height="325" Width="500" Margin="20,0" TitleText="My Item" NoteText="" ShowNote="Collapsed" ShowSubTitle="Collapsed"/>
            -->
        </WrapPanel>
        <WrapPanel Style="{DynamicResource wrpPnlProductCategoriesPanels}" x:Name="wrpPnlProductCategories2">
            <!-- Constant currently for count of buttons per WrapPanel = 6-->
            <!-- This is filled in dynamically at runtime
        <controls:btnLarge Height="325" Width="500" Margin="20,0" TitleText="My Item" NoteText="" ShowNote="Collapsed" ShowSubTitle="Collapsed"/>
            -->
        </WrapPanel>
    </StackPanel>
  <Kiosk:SwipeForMoreArrow x:Name="ctrlSwipeForMoreArrow" HorizontalAlignment="Right" VerticalAlignment="Center" Visibility="Collapsed"/>
</ScrollViewer>
abatishchev
  • 98,240
  • 88
  • 296
  • 433
ClosDesign
  • 3,894
  • 9
  • 39
  • 62

1 Answers1

0

Do you aim to make this possible only through XAML? Otherwise you could try to get the this.HorizontalOffset of the Scrollviewer via the OnScrolledChanged Event to identify wether it´s 0 or max. Maybe this link might help too: How to find that ScrollViewer is scrolled to the end in WPF?

Community
  • 1
  • 1
Ben
  • 925
  • 5
  • 11