Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am getting the below error when I am trying the remove the tabitem from tabcontrol.

Cannot modify the logical children for this node at this time because a tree walk is in progress. Please find the below stack trace.

at System.Windows.FrameworkElement.RemoveLogicalChild(Object child)
at MS.Internal.Controls.InnerItemCollectionView.ClearModelParent(Object item)
at MS.Internal.Controls.InnerItemCollectionView._RemoveAt(Int32 index, Int32 indexR, Object item)
at MS.Internal.Controls.InnerItemCollectionView.RemoveAt(Int32 index)
at System.Windows.Controls.ItemCollection.RemoveAt(Int32 removeIndex)
Posted
Comments
CHill60 9-Jul-14 9:22am    
Post the code that is giving you the exception

1 solution

fishboneControl.Remove(PersonPage);

C#
public void Remove(FishbonePage page)
       {
           for (var i = 0; i < Items.Count; ++i)
           {
               var currentPage = GetFishbonePage(Items[i], i);
               if (currentPage == null || !ReferenceEquals(currentPage, page))
               {
                   continue;
               }

               Items.RemoveAt(i);
           }

           EnsureChildPages();
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900