TabControlEx & creating new tabs
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
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
SIGN IN To post a reply.
8 Replies
CS
C. Sudha
Syncfusion Team
August 20, 2009 10:09 AM UTC
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.
Your requirements could be easily achieved by writing template for TabItemExt.
The following code snippets demonstrate the same.
XAML:
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.
LJ
Loïc JOLY
August 20, 2009 01:05 PM UTC
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
badTabOrder_667888a3.png
LJ
Loïc JOLY
August 20, 2009 01:08 PM UTC
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
Best regards,
badTabMenu_d6122b3f.png
CS
C. Sudha
Syncfusion Team
August 22, 2009 10:21 AM UTC
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
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
LJ
Loïc JOLY
August 24, 2009 07:49 AM UTC
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,
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,
CS
C. Sudha
Syncfusion Team
August 25, 2009 12:32 PM UTC
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.
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.
LJ
Loïc JOLY
November 13, 2009 01:48 PM UTC
I've just read vol4 documentation, but I haven't found anything related to this issue. Have I missed something?
HK
Hemanth Kumar K
Syncfusion Team
November 16, 2009 03:56 PM UTC
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
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
SIGN IN To post a reply.
- 8 Replies
- 3 Participants
-
LJ Loïc JOLY
- Aug 19, 2009 05:50 PM UTC
- Nov 16, 2009 03:56 PM UTC