Xaml ScrollViewer到达底部WindowsPhone8

Xaml ScrollViewer到达底部WindowsPhone8,xaml,windows-phone-8,winrt-xaml,scrollviewer,appbar,Xaml,Windows Phone 8,Winrt Xaml,Scrollviewer,Appbar,当用户到达(ScrollViewer)页面的末尾时,我正在尝试打开应用程序栏。。。 因此,我需要一个指标,当到达终点 我的Scrollviewer(可能是因为WP8)没有“ViewChanged”事件 就像在其他问题中发布的一样 这个解决方案对我的问题来说太过分了我认为: 我在这个查看器中找不到任何可以帮助我的事件 <ScrollViewer x:Name="SV_ScrollViewer" Grid.Row="1"

当用户到达(ScrollViewer)页面的末尾时,我正在尝试打开应用程序栏。。。 因此,我需要一个指标,当到达终点

  • 我的Scrollviewer(可能是因为WP8)没有“ViewChanged”事件 就像在其他问题中发布的一样
  • 这个解决方案对我的问题来说太过分了我认为:
我在这个查看器中找不到任何可以帮助我的事件

       <ScrollViewer x:Name="SV_ScrollViewer"
                      Grid.Row="1" 
                      Margin="12,0,12,0"
                      ManipulationMode="Control"                       
                      AllowDrop="False">
            <Grid x:Name="ContentPanel">
                <StackPanel>
                    <Controls:Map                             
                        Height="730"
                        x:Name="M_MainMap"                                  
                        ZoomLevel="10" 
                        Loaded="Map_Loaded"/>
                    <phone:LongListSelector 
                        x:Name="LLS_FuelStations" 
                        Height="700">                        
                    </phone:LongListSelector>
                </StackPanel>                    
            </Grid>
        </ScrollViewer>
关闭和打开应用程序栏:

private void OffsetWatcher()
        {
            if (SV_ScrollViewer.ScrollableHeight - SV_ScrollViewer.VerticalOffset > 100 )
            {
                if (ApplicationBar.IsVisible)
                {
                    ApplicationBar.IsVisible = false;
                    ApplicationBar.IsMenuEnabled = false;
                }
            }
            else
            {
                if (!ApplicationBar.IsVisible)
                {
                    BuildLocalizedApplicationBar();
                }   
            }
        }

使用布局更新这里的代码我使用和调试,以获得滚动效果。您可能还需要跟踪指针被按下的位置以及scroll viewer操纵完成的事件。下面是在代码隐藏中添加相应事件处理程序的xaml

 <ScrollViewer ManipulationCompleted="ScrollViewer_ManipulationCompleted" ManipulationMode="All">
        <StackPanel  LayoutUpdated="StackPanel_LayoutUpdated" PointerPressed="StackPanel_PointerPressed">
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
            <Grid Height="100" Width="100" Background="Red" ></Grid>
            <Grid Height="100" Width="100" Background="Green" ></Grid>
            <Grid Height="100" Width="100" Background="Blue" ></Grid>
            <Grid Height="100" Width="100" Background="Yellow" ></Grid>
        </StackPanel>
    </ScrollViewer>

这是背后的代码

        public MainPage()
    {
        this.InitializeComponent();
    }

    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.  The Parameter
    /// property is typically used to configure the page.</param>
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {

    }


    private void ScrollViewer_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
    {
        //scroll bar being dragged
    }

    private void StackPanel_LayoutUpdated(object sender, object e)
    {
        //if swipe gesture then check for vertical offset and carry on with the //calculations you have to do else do nothing
    }

    private void StackPanel_PointerPressed(object sender, PointerRoutedEventArgs e)
    {
        //swipe gesture being made
    }
public主页()
{
this.InitializeComponent();
}
/// 
///当此页面即将显示在框架中时调用。
/// 
///描述如何到达此页面的事件数据。参数
///属性通常用于配置页面。
受保护的覆盖无效OnNavigatedTo(NavigationEventArgs e)
{
}
私有void ScrollViewer_操作已完成(对象发送方,操作已完成RoutedEventArgs e)
{
//正在拖动的滚动条
}
私有void StackPanel_布局已更新(对象发送方,对象e)
{
//若使用滑动手势,则检查垂直偏移量,并继续//计算,否则不必执行任何操作
}
private void StackPanel_PointerPressed(对象发送方,PointErrorouted事件参数e)
{
//正在做的刷卡手势
}

请让我知道它是否有效

也许编写您自己的代码会有所帮助,因为不存在此类事件此问题的副本要求事件而不是检查偏移量的方法,我在问题中写道,此副本对此是“过度杀伤力”。我编辑了我的问题。layoutUpdated事件非常适合于此。我没有“ponterPressed”事件。。。但不管怎样,只要“layoutUpdated”就行了。我不知道其他的活动有哪些。谢谢你的欢迎:)请告诉我是否还有其他问题:)显然在我的范围内:D
        public MainPage()
    {
        this.InitializeComponent();
    }

    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.  The Parameter
    /// property is typically used to configure the page.</param>
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {

    }


    private void ScrollViewer_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
    {
        //scroll bar being dragged
    }

    private void StackPanel_LayoutUpdated(object sender, object e)
    {
        //if swipe gesture then check for vertical offset and carry on with the //calculations you have to do else do nothing
    }

    private void StackPanel_PointerPressed(object sender, PointerRoutedEventArgs e)
    {
        //swipe gesture being made
    }