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.