2016-04-18 53 views
1

后我使用xamarin形式来开发我的项目,现在我使用的是杰森 - 史密斯组件刷新我的看法Xamarin - 刷卡刷新刷新图标仍然存在执行命令

https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout

然而,我使用下面的代码

 scrollControl.RefreshCommand = RefreshCommand; 
     public ICommand RefreshCommand 
     { 
      get {return new Command(async() => await ContentScrollView_Scrolled()); } 
     } 
     async Task ContentScrollView_Scrolled() 
     { 
...... 
     } 

在结束后我执行所有的代码,刷新图标仍然保留在那里打转,我试图把scrollControl.isRefreshing =假在命令的结尾,然而不起作用,任何人都可以帮助我 有了这个?

+0

你可以添加完整的代码吗? – Sreeraj

回答

0

好了好了,该解决方案是有点怪异,我发现它,因为isrefreshing属性为false,所以我在代码开头isrefreshing设置为true,我还以为它会自动设置为真,所以我必须自己手动它,最后它是像魅力

scrollControl.RefreshCommand = RefreshCommand; 
     public ICommand RefreshCommand 
     { 
      get {return new Command(async() => await ContentScrollView_Scrolled()); } 
     } 
     async Task ContentScrollView_Scrolled() 
     { 
     scrollControl.isRefreshing = true; 
...... 
     scrollControl.isRefreshing = false; 
     } 
0

我怀疑当你的刷新完成时,你没有更新UI线程上的IsRefreshing属性。试试这个:

// after your refresh command completes 
Device.BeginInvokeOnMainThread (() => { 
    scrollControl.IsRefreshing = false; 
}); 
+0

嗨杰森,最后,源不工作,当我调试它,调试滚动事件时,isrefreshing默认为false –