Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1655
Close TabItemEx
posted

Hi,

I want to close a TabItem from the TabItem i am currently in.

For example say, there is a button in Tab Header 2. On click of that button i want to close the Tab Header 2 tab and go to Tab Header 1.

Can you tell me how to do this?

 

Thanks & Regards,

Varun R

Parents
No Data
Reply
  • 54937
    Suggested Answer
    Offline posted

    As Alex mentioned in a reply to your previous posting about this, there are several commands defined for closing a pane. So if you have a TabItemEx instance that you want to close, you can invoke its ExecuteCommand method with that command (e.g. tabItem.ExecuteCommand(TabItemExCommands.Close) ). The default template for TabItemEx contains a button that uses this command and targets the TabItemEx instance.

    If you want to try and control what tab gets focus after the tab is closed then you could handle the TabItemEx' Closed event and then set the SelectedItem of the tab control to a different tab item (or set the SelectedIndex to a different visible tab).

Children