开发者

Showing Infragistics UltraTabControl's shared content even with no tabs

开发者 https://www.devze.com 2023-01-29 23:41 出处:网络
We have a screen that shows a grid inside a tab control. There\'s one grid instance, and it needs to always be visible, regardless of which tab you\'re on. (We repopulate its content when you switch t

We have a screen that shows a grid inside a tab control. There's one grid instance, and it needs to always be visible, regardless of which tab you're on. (We repopulate its content when you switch tabs, but it's always the same grid instance.) The UltraTabControl has a "shared controls page" that seems perfect for this, and most of the time it works great.

However, when开发者_运维问答 the tab control has no tabs at all, Infragistics does not show the shared controls. We need the grid to be visible even if there are no tabs at the top of the tab control.

Is there a way I can get the shared content to show, even when there are no tabs?


Apparently there's no way to do this directly. I wound up working around it by re-parenting the content when there are no tabs.

For example, suppose I have a panel (panel1) that contains the tab control (ultraTabControl1), whose shared page (sharedPage1) normally contains a grid (grid1). I run code like this every time I change the list of tabs:

var anyTabs = ultraTabControl1.Tabs.Count > 0;
ultraTabControl1.Visible = anyTabs;
grid1.Parent = anyTabs ? sharedPage1 : panel1;

Inelegant, but at least it works.


A better way may be to use the UltraTabStribControl. That's basically just the header of a TabControl without the content Panels. With that you just need to place a Tabstrip on top and the grid below. But ff you have other controls which are shown dependent on the tab then you would have to hide/show them manually or stick to the full TabControl.

0

精彩评论

暂无评论...
验证码 换一张
取 消