Wpf exception: An ItemsControl is inconsistent with its item source. wpfitemscontrol

Source: Internet
Author: User

Wpf exception: An ItemsControl is inconsistent with its item source. wpfitemscontrol

Bind a dic to the listview. Sometimes this exception is reported in the drop-down list. Because itemssource = dic is used directly, and dic is occasionally updated on another thread, this error will be reported if it is directly bound, the reason is that the memory address of itemssource is directly directed to the memory address of dic. When dic is updated, the memory address changes, and the program cannot read the data in the memory and reports an error. The simplest solution is to use a new dictionary to pass the dic to the system and assign it to itemssource. In this way, the new dic will have another dedicated memory space, no matter how the original dic changes, it will not affect the new dic. The memory overhead is doubled, which is out of consideration.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.