On button click, Updating the ListBox
ItemsSource
collection.
For 4 or 5 clicks its working fine but afterwards it throws an exception as '[Unknown]' property does not point to a DependencyObject
in path '(0).(1)[1].(2)'
I googled it & find the reason for it.
"The ElementControl overrides PrepareContainerForItemOverride and calls PrepareModel to insert a mesh into _modelContainer for each Item. Later in ElementFlow.BuildTargetPropertyPath (which is called via ElementFlow.SelectItemCore -> LayoutBase.SelectElement -> ElementFlow.PrepareTemplateStoryboard) it is assumed that such a mesh has been inserted into _modelContainer. This exception occurs when the mesh has not been inserted into _modelContainer. WPF calls PrepareContainerForItemOverride on ApplyTemplate. This is only done once. Items added later are never processed like that. "
So please provide me a solution to overcome it.