在点击按钮之前,ListItems.ItemSource显然是数据?怎么做? [英] ListItems.ItemSource is clearly data before I click on button? How to do that?

查看:62
本文介绍了在点击按钮之前,ListItems.ItemSource显然是数据?怎么做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望ListItems.ItemSource在我点击按钮之前清楚地(删除旧数据)数据。

I want ListItems.ItemSource is clearly(delete old data) data before I click on button.

private void btnSearching_Click(object sender, RoutedEventArgs e)  
      {ListItems.ItemSource=ResultofSearching(results[0],txtSearching.Text)};





Eg

第一次单击按钮然后listitems将返回结果

第二次单击按钮时,listitems将在第一次删除数据并返回最新数据。

实际上,我可以第三次点击按钮。在第四次,第五次......,listitems不会返回任何东西,没有...

我不解释这个?对不起。



E.g
On the first time it was clicked button then listitems will return that results
On the second time it was clicked button then listitems will be delete data on the first time and return newest data.
actually, I can clicked on button to on the third times. On the fourth times ,fifth...,listitems will not return anything, nothing...
I dont explain about that? Sorry.

推荐答案

每次点击按钮清除列表

试试

listitem.clear() ;

在你完成其余功能之前。每次点击按钮都会清空列表清空



对不起,如果这不是你想要的。如果不是,你可以解释一下吗?
clear the list every time you click the button
try
listitem.clear();
before you did the rest of the function. it will clear the list to empty everytime you click the button

sorry if this is not really what you want. if it isn't can you explain more?


这篇关于在点击按钮之前,ListItems.ItemSource显然是数据?怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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