RadTabControl Item Wrapping

5 posts, 0 answers
  1. Brandmuscle
    Brandmuscle avatar
    19 posts
    Member since:
    Nov 2008

    Posted 28 Apr 2009 Link to this post

    When I am adding tabs to my tabcontrol I noticed that the tabs size according to the size of the control (their parent).  Is there any way to have the tabs actually wrap onto a 2nd (or even 3rd) level?

    For example: In your demo, you have an "Add Tab" button, but you can only add so many tabs....  If you keep adding tabs you will start to see that the tabs get VERY small and unreadable.  Is there a way to have them "Auto Wrap" onto a 2nd tier of some sort?  Could this be something that is thought about for future enhancements?

    Thanks a bunch
  2. Brandmuscle
    Brandmuscle avatar
    19 posts
    Member since:
    Nov 2008

    Posted 28 Apr 2009 Link to this post

    Or even some scroll buttons to let me scroll through tabs would be nice too.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 29 Apr 2009 Link to this post

    Hello Dan,

    Currently, the row breaking has to be set explicitly, with IsBreak.

    We are planning to add both automatic breaking and scrollbars, though I cannot put a timestamp on these features.

    As a workaround currently you can use the default TabPanel, with the twist that you need to mark selected items explicitly, so that it will rearrange them when selected.

    Please find the sample code below:

    private void RadTabControl_SelectionChanged(object sender, RoutedEventArgs e)  
    {  
        SetIsSelected(sender);  
    }  
     
    private static void SetIsSelected(object sender)  
    {  
        var itemControl = sender as ItemsControl;  
     
        foreach (var item in itemControl.Items)  
        {  
            var visual = itemControl.ItemContainerGenerator.ContainerFromItem(item)  
                as RadTabItem;  
            if (visual != null)  
            {  
                Selector.SetIsSelected(visual, visual.IsSelected);  
            }  
        }  
    }  
     
    private void tabControl_Loaded(object sender, RoutedEventArgs e)  
    {  
        //Change the selection so that the Panel will start working.  
        tabControl.SelectedIndex = 1;  
    }  
     


    <Window x:Class="TabControlAutoWrap.Window1" 
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
            xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework" 
            Title="Window1" Height="300" Width="300">  
        <Grid> 
            <telerik:RadTabControl x:Name="tabControl" SelectedIndex="0" 
                    ReorderTabRows="False" 
                    SelectionChanged="RadTabControl_SelectionChanged" 
                    Loaded="tabControl_Loaded">  
                <telerik:RadTabControl.ItemsPanel> 
                    <ItemsPanelTemplate> 
                        <primitives:TabPanel /> 
                    </ItemsPanelTemplate> 
                </telerik:RadTabControl.ItemsPanel> 
                <telerik:RadTabItem Header="Long Tab Header" /> 
                <telerik:RadTabItem Header="Long Tab Header" /> 
                <telerik:RadTabItem Header="Long Tab Header" /> 
                <telerik:RadTabItem Header="Long Tab Header" /> 
                <telerik:RadTabItem Header="Long Tab Header" /> 
            </telerik:RadTabControl> 
        </Grid> 
    </Window> 

    Hopefully this will work for you,

    All the best,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Murali
    Murali avatar
    8 posts
    Member since:
    May 2013

    Posted 20 Mar 2014 in reply to Miroslav Link to this post

    Hello Telerik Team,

    Has there been any progress on this feature?  I have been looking to find out how to wrap the tab well for a couple of hours and finally got to this post - only to find that it wasn't working back in 2012 and there is hope to see this working, I wonder if you have some good news to share...
  6. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 24 Mar 2014 Link to this post

    Hello Murali,

    We have implemented this feature and you could use it by setting the OverflowMode property of the RadTabControl to "Wrap".

    I hope this information helps.

    Kind regards,
    Kiril Vandov
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready