在Windows Phone 8.1 Silverlight应用程序中的ItemsControl下添加“加载更多”按钮 [英] Adding a 'Load More' button below ItemsControl in windows phone 8.1 Silverlight application

查看:60
本文介绍了在Windows Phone 8.1 Silverlight应用程序中的ItemsControl下添加“加载更多”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   

我正在实现一个RSS阅读器应用程序,我正在使用ItemsControl来显示新闻项目。我试图在ItemsControl下面添加一个'加载更多'按钮,如下所示:

   

I am implementing a RSS reader application and i am using ItemsControl to display the news items. I tried to add a 'Load More' button below the ItemsControl like this

<Grid x:Name="LayoutRoot">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="auto" />
       </Grid.RowDefinitions>       
    
       <ItemsControl x:Name="itemsControl"  Margin="10,10,10,0" Grid.Row="0">
         <ItemsControl.ItemsPanel>
           <ItemsPanelTemplate>
             <VirtualizingStackPanel>                       
           </VirtualizingStackPanel>
         </ItemsPanelTemplate>
         
        </ItemsControl.ItemsPanel>
          <ItemsControl.Template>
            <ControlTemplate TargetType="ItemsControl">
              <ScrollViewer>
                <ItemsPresenter />
              </ScrollViewer>
             </ControlTemplate>
           </ItemsControl.Template>
         </ItemsControl>
    
        <TextBlock x:Name="loadMoreTextBlock" Grid.Row="1" Text="Load more"/>
    </Grid> 


  &NBSP;

   

但是文本块在滚动结束时不显示,并且始终在根网格中可见。当用户向下滚动到底部时,我想仅在itemscontrol的末尾显示"加载更多"文本。

像这样更改ItemsControl.Template

But the textblock is not displayed in the end of the scrolling and it is always visible in the root grid. I want to display the 'Load More' text only at the end of the itemscontrol as the user scrolls down to bottom.
Changing the ItemsControl.Template like this

   <ItemsControl.Template>
        <ControlTemplate TargetType="ItemsControl">
          <ScrollViewer>
            <StackPanel>
              <ItemsPresenter />
              <TextBlock x:Name="loadMoreTextBlock" Text="Load more"/> 
             </StackPanel>               
          </ScrollViewer>
         </ControlTemplate>
       </ItemsControl.Template>

解决了问题,但ItemsControl的性能很差。您有什么更好的想法或建议吗?



谢谢你
Vinoth Selvaraj





solves the problem, but the performance of the ItemsControl is poor. Do you have any better idea or suggestions?

Thanks
Vinoth Selvaraj


推荐答案

由于您正在控制数据,那么将该文本作为最后一项插入然后做出反应用户点击它。
Since you are controlling the data, what about inserting that text as your last item and then react to the user clicking on it.


这篇关于在Windows Phone 8.1 Silverlight应用程序中的ItemsControl下添加“加载更多”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆