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