RadTabItem not honoring MinWidth?

5 posts, 0 answers
  1. Stuart
    Stuart avatar
    12 posts
    Member since:
    Feb 2009

    Posted 18 May 2009 Link to this post

    I'm using a RadTabControl which contains a starting number of fixed items, and allows for any number of additional items to be added. I don't want any of these items to shrink below a certain size, so I've set a MinWidth value for both the fixed and dynamic items. However, as I add RadTabItems dynamically it appears that the MinWidth setting is being ignored.

    Any insight offered on this issue will be greatly appreciated.
  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 19 May 2009 Link to this post

    Hi Stuart,

    If you want to set minimum width of the RadTabItems,  you have to set the MinWidth property in the code behind rather than in xaml.

    Hope this helps.

    Sincerely yours,
    Dimitrina
    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.
  3. DevCraft banner
  4. Stuart
    Stuart avatar
    12 posts
    Member since:
    Feb 2009

    Posted 20 May 2009 Link to this post

    Hi Dimitrina,

    Unfortunately, your sample shows the issue perfectly if you remove the tabControl.Items.Count conditional, as follows:

            void AddTab(object sender, EventArgs e)
            {
                RadTabItem itemToAdd = new RadTabItem()
                {
                    Header = "New Tab",
                    Width = 125,
                    MinWidth = 100
                };
                tabControl.Items.Add(itemToAdd);
        }

    With this modification, if you keep clicking the [Add Tab] button, all the tabs will gradually get smaller and smaller.

    I continue to believe that RadTabItem is not honoring MinWidth.



  5. Stuart
    Stuart avatar
    12 posts
    Member since:
    Feb 2009

    Posted 20 May 2009 Link to this post

    BTW, here's a feature request / comment that goes along with the MinWidth issue.

    Ideally, RadTabControl would support a Multiline setting much like the framework TabControl, which would allow the control to determine when to add new rows of tabs, as opposed to forcing the developer to determine where / when to insert IsBreak. This would ideally be determined by entering a new row of tabs whenever enough tabs are added so that the combined MinWidth values exceed the parent TabControl's ActualWidth.

  6. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 21 May 2009 Link to this post

    Hi Stuart,

    The default panel of the RadTabControl supports only explicit breaking, but you can use other panels like the WrapPanel and the default Tab panel to enable the automatic wrapping. I have attached an example on how to do this.

    The MinWidth in this case works like it would in the columns of a grid - the does not in fact get smaller but is clipped by other items.

    Also, instead of setting the MinWidth of an item in code, you can assign an ItemContainerStyle to the TabControl that will set the style of all items, there you can include:

    <Setter Property="MinWidth" Value="150"  />

    Note that the ItemContainerStyle would work only when the items are databound.

    The PanelChange will mean that unfortunately the selected row will not automatically move towards the content. We will address those issues in a coming upgrade of the TabControl.

    Thank you for your feedback!

    Kind regards,
    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.
Back to Top
DevCraft banner