I'd like to enable a button if some Data is available:
private void myListBox_ItemSelectionChanged(object sender, EventArgs e)
{
downloadButton.Enabled = myList.SelectedItems.Cast<myClass.myObject>().Any(x => x.Data != null);
}
The problem is that the UI is not quite responsive, and behaves weirdly (sometimes when I click the selection does not get changed when I click and select a different element). I figured that this is because of that bit of code.
Any suggestion to speed things up?