Live Chat Icon For mobile
Live Chat Icon

Can ItemsControl’s Items and ItemsSource properties be modified simultaneously ?

Platform: WPF| Category: DataBinding

ItemControl’s items and ItemsSource can’t be modified simultaneously. ItemControl’s ‘Items’ property is used to add items manually and ‘ItemsSource’ property is used to bind the ItemControl with the datasource. You must not mix these techniques, simply for the reason that ItemsSource can only be set when there are no items in the Item collection and Items can only be set when the ItemsSource is set to null. Otherwise you’ll get an ‘InvalidOperation’ Exception. Note that regardless of which method you use to set items in an ItemControl, you can always retrieve items using the ItemsCollection.

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.