This is a migrated thread and some comments may be shown as answers.

RadTabItem not honoring MinWidth?

4 Answers 94 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 18 May 2009, 08:51 PM
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.

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 19 May 2009, 03:07 PM
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.
0
Stuart
Top achievements
Rank 1
answered on 20 May 2009, 05:45 PM
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.



0
Stuart
Top achievements
Rank 1
answered on 20 May 2009, 05:54 PM
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.

0
Miroslav
Telerik team
answered on 21 May 2009, 07:11 AM
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.
Tags
TabControl
Asked by
Stuart
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Stuart
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or