TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
TAN WhoAMI
NA
291
0
Clear WPF ListBox which is bind to a list
Jun 10 2012 10:24 PM
I am trying to clear and populate the WPF ListBox with new values at each click of the button, but apparently, I cannot clear it because it is bind to some list.
error message is as below when the commented line is there:
Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.
My source code is as attached.
Appreciate any useful help.
================================
I have found the answer. Replace the commented line with
lucky_listBox.ItemsSource =
null
;
Attachment:
code.zip
Reply
Answers (
1
)
Binding foregrounds using IMultiValueConverter
WPF Listbox and DataTables