Thank you Stephen..you suggestion was correct...using winforms...

 

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Stephen Price
Sent: Thursday, 29 April 2010 1:42 PM
To: ozDotNet
Subject: Re: Remove Myself using XtraTabControl

 

I couldn't tell if the controls are for WPF or Winforms... but I've done
this in Silverlight with normal TabControl so it might be useful. I get the
Tabitem from the button then remove the tab from the collection that the
tabcontrol is bound to. 

 

 var tabItem = GetParentTabItem((FrameworkElement)sender);

            

            if (tabItem != null)

            {

                tabs.Remove(tabItem);

            }

 

 

private static TabItem GetParentTabItem(FrameworkElement tabItem)

        {

            var parent =
(FrameworkElement)VisualTreeHelper.GetParent(tabItem);

            if (parent == null)

                return null;

            if (parent is TabItem)

                return (TabItem)parent;

            return GetParentTabItem(parent);

        }

 

Might not help you but looking at the documentation for the control, there's
a TabPages collection on the control which has a Remove method. You need to
get the instance of the Tab you are wanting to close somehow (if the above
code doesn't help) and then you can remove it.

 

HTH,

Stephen

 

On Thu, Apr 29, 2010 at 11:26 AM, Anthony <[email protected]> wrote:

I'm sure this is easy but I have XTraTabControl  that i add tabs to at
runtime.  I have close button on the tab.  Question..how do i get the Close
button to remove itself from the TabControl

 

Is your <http://www.intellixperience.com/signup.aspx>  website being
IntelliXperienced?
regards
Anthony (*12QWERNB*)

Is your website being IntelliXperienced?

 

 

 

Reply via email to