How the hell do you programmatically close a TabItem in a Windows 8 WPF Desktop TabControl?
There are no options in Intellisense, and the only things that appear in search results are custom implementations of either the TabControl or the TabItem.
Why can't we just do something like tabControl.SelectedItem.Close();
?
I think that closing is the same as removing TabItem from TabControl
Edit: For Ex:
tabControl1.Items.RemoveAt(tabControl1.SelectedIndex);
You cannot close it. TabItem
is not closeable. You can just hide it:
tabControl.SelectedItem.Visibility = System.Windows.Visibility.Collapsed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.