List Box and List<string> Connection

℡╲_俬逩灬. 提交于 2020-01-07 04:33:27

问题


I have problem in C#.

I have a list box and a class called FileManager. FileManager contains, a method called ValidateFile which validate and valid files need to add to a list in the FileManager class.

I want to add contents of list to my list box. And I am just running through the list and adding to my listbox.

Since, ValidateFile in FileManager Class takes little more time and to keep my UI live, I am calling ValidateFile method on a Delegate.

But I am searching for good way to populate my listbox when FileManager.List changes or for any change in the list should reflect in my listbox.

please post code or web links if you have.

Thank you, harsha


回答1:


I believe you're interested in the ObservableCollection<T> class, see MSDN.



来源:https://stackoverflow.com/questions/5216766/list-box-and-liststring-connection

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