We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

TabControlEx & creating new tabs

Thread ID:

Created:

Updated:

Platform:

Replies:

89197 Aug 19,2009 01:50 PM Nov 16,2009 10:56 AM WPF 8
loading
Tags: Tools
Loïc JOLY
Asked On August 19, 2009 01:50 PM

Hello,

I'm new to SyncFusion, and I wanted to know if it was possible to give the user the possibility to create an extra tab at run time, by showing it a dummy tab (with a + sign), à la IE or FireFox.

I can't find this feature in the control, nor the way to add it easily (I would need to create this dummy tab myself, but this tab shoud be handled differently from other tabs, wrt drag&drop, for instance).

Best regards



TabNew_3ef62336.png

C. Sudha [Syncfusion]
Replied On August 20, 2009 06:09 AM

Hi,

Your requirements could be easily achieved by writing template for TabItemExt.

The following code snippets demonstrate the same.

XAML:




x:Key="myTabItem">
Margin="1,0,0,0"
BorderBrush="SkyBlue"
Background="{StaticResource background}"
CornerRadius="5,5,0,0">








MouseLeftButtonUp event for TabItemExt.

C#:

private void addTab_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
try
{
if (TabControlExt1 != null)
{
TabItemExt tab = new TabItemExt();
tab.Header = "New Tab";
tab.BorderBrush = Brushes.SkyBlue;
TabControlExt1.Items.Insert(TabControlExt1.Items.Count - 1, tab);
tab.Focus();
}
}
catch (Exception) { }
}


Please download the below sample for more reference.

http://files.syncfusion.com/support//Tools.WPF/7.3.0.20/89197/main.htm

Please let us know if you have any questions.

Thanks for your interest in Syncfusion products.

Regards,
SudhaC.

Loïc JOLY
Replied On August 20, 2009 09:05 AM

It looks like what I had in mind, and has the problem I was alluding to when talking about tab drag&drop. Please look at the attached screenshot of this example program, where the "+" pseudo-tab is no longer placed at the right position.





badTabOrder_667888a3.png

Loïc JOLY
Replied On August 20, 2009 09:08 AM

Another point is that this tab can be selected (not with the mouse, but by the ctrl-tab shortcut, or the tabs menu).

Best regards,



badTabMenu_d6122b3f.png

C. Sudha [Syncfusion]
Replied On August 22, 2009 06:21 AM

Hi,

Thanks for choosing Syncfusion products.

Your requirements could be achieved only by workaround while dragging and dropping of tabitem.

For Instance,


// Temporary varaible for storing dragged item
int draggedItemIndex = 0;
TabItemExt draggedItem = null;

private void TabControlExt1_DragEnd(object sender, TabControlExtDragEventArgs e)
{
// Store the dragged item before drop
draggedItem = TabControlExt1.SelectedItem as TabItemExt;
draggedItemIndex = TabControlExt1.Items.IndexOf(draggedItem);
}


private void TabControlExt1_Drop(object sender, DragEventArgs e)
{
int i = TabControlExt1.SelectedIndex;

// Check the dragged item is placed at the end of the Tab
if (i == TabControlExt1.Items.Count - 1)
{
// Remove that dragged item
TabControlExt1.Items.RemoveAt(i);
// Placed the dragged item in original position itself.
TabControlExt1.Items.Insert(draggedItemIndex, draggedItem);
TabControlExt1.SelectedIndex = draggedItemIndex;
}
}

Your query regarding 'tab can be selected (not with the mouse, but by the ctrl-tab shortcut, or the tabs menu)' is
achieved by writing the trigger for selecting the tab.

Please download the modified sample from below mentioned location for more information. Hope this will resolve your problem.


http://files.syncfusion.com/support//Tools.WPF/7.3.0.20/89197/ModifiedTabControlIE7_Demo.zip


Please let us know if you have any other queries.

Regards,
Sudha.C




Loïc JOLY
Replied On August 24, 2009 03:49 AM

I'd first like to thank you for your efforts in helping me. The current version of the example is better, and gives some ideas about how to reach my goal. It still has many glitches, for instance, the '+' tab can still be dragged, it appears in the tab menu... I think I can work around most of those.

One glitch for which I'm not sure I can find a workaround is the preview arrow. In your example, when doing drag&drop, the preview arrow still appears right of the '+' tab, even if the drop is not allowed here.

My need of this function is important, but not that urgent. Do you know if you have plans to natively support it in a future version of you product? I'd like to know if the best alternative for me is to go and fight all those glitches (maybe with your help at some point) or simply to wait for the next version.

Best regards,



C. Sudha [Syncfusion]
Replied On August 25, 2009 08:32 AM

Hi,

Thanks for choosing Syncfusion products.

By using the MouseMove and MouseLeave event of addtab, we can prevent the dragging of '+' tab. For instance,

In C#:

private void addTab_MouseMove(object sender, MouseEventArgs e)
{
TabControlExt1.AllowDragDrop = false;
}

private void addTab_MouseLeave(object sender, MouseEventArgs e)
{
TabControlExt1.AllowDragDrop = true;
}


Regarding your query about tab menu and preview arrow is more complicated by work around.

Yes. We have already filed a feature report about this when we started conversing and we have started to work on this feature. We will definitely include this in our Vol - 4 release. We will update you as soon as this feature gets implemented.

Thank you for your patience.

Please let us know if you have any questions.

Regards,
SudhaC.

Loïc JOLY
Replied On November 13, 2009 08:48 AM

I've just read vol4 documentation, but I haven't found anything related to this issue. Have I missed something?


Hemanth Kumar K [Syncfusion]
Replied On November 16, 2009 10:56 AM

Hi,

This Feature is Under implementation Status and it will be available within a week. Kindly Create new incident in our direct trac system . so that we will update you custom assemblies with this feature.

Please Let us Know if you have any queries,

Thanks,
HemanthKumar K

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;