.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > Tabitem removing problem.
 

Tabitem removing problem.

Hello again.

I have a simple question, probably a simple answer, but I can't figure it out :(

I'm creating tabitem dynamically. I've done that, but now I want to remove it...

this .ClearValue(UserControl .ContentProperty);

var tc = VisualTreeHelperExtensions .FindAncestor<TabControl >(this );

tc.Items.Remove(tc.SelectedIndex);


All good, except for the tab remaining at the top, unselected. The third line should be enough.

My search only returns hi-tech scenarios, I just need for the tab to be removed.

Thank you.
http://problemaresolvido.blogspot.com/
JustBeFree
Ok, I guess

TabItem ti = (TabItem)tc.Items[tc.SelectedIndex];
tc.Items.Remove(ti);

is the answer...

Sorry for the spam.
http://problemaresolvido.blogspot.com/
  • Marked As Answer byJustBeFree Wednesday, September 23, 2009 7:10 AM
  •  
JustBeFree
Ok, I guess

TabItem ti = (TabItem)tc.Items[tc.SelectedIndex];
tc.Items.Remove(ti);

is the answer...

Sorry for the spam.
http://problemaresolvido.blogspot.com/
  • Marked As Answer byJustBeFree Wednesday, September 23, 2009 7:10 AM
  •  
JustBeFree

You can use google to search for other answers

Custom Search

More Threads

• Exception with a Dynamic Resource in an Animation?
• Bug with validation?
• DwmEnableComposition(bool) Call Not Working on 5384
• Sharing resources among WPF projects?
• Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154 in c# application
• Setting focus on a texbox inside a datatemplate of Listbox
• How to modify button tooltips in the documentviewer controller
• MediaElement.Volume = 0 not working ?!?
• MDI in WPF
• Merge/Split table cells in RichTextBox