How to set property isEnabled in each subitem button of listview in windows phone winrt?

耗尽温柔 提交于 2019-12-12 05:29:12

问题


I have listview. In this listview I have listview.item that contains button. I bind my listview to some datasource, so I have many buttons. How to disable all of this buttons?

http://pastebin.com/6MFDfX9S


回答1:


Looking at your code, besides binding to "Title", "Date", "DownloadedOrNot" and "Info" you can add another property and bind that to the IsEnable property of the buttons, like "IsEnable.

If you need to change the value of this property you can always traverse your ListView Items like this:

foreach (var item in listview.Items)
{
    (item as your_object).IsEnable = false;
}



回答2:


If you have lots of buttons.. Use LINQ insted.

listview.Items.All(item =>{(your_obj)item.IsEnable=false; return true});


来源:https://stackoverflow.com/questions/29308554/how-to-set-property-isenabled-in-each-subitem-button-of-listview-in-windows-phon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!