在WPF中,如何获取tabItem的内容以填充可用空间?

时间:2022-12-04 22:41:44

I do not know what I am doing wrong here. In the XAML below, the Border does not fill the available space on the tabItem (just lots of whitespace). How do I fill the entire tab page?

我不知道我在这里做错了什么。在下面的XAML中,Border没有填充tabItem上的可用空间(只有很多空格)。如何填写整个标签页?

<TabControl>
    <TabItem Header="Plant State">
        <Border Background="Red" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></Border>
    </TabItem>
</TabControl>

2 个解决方案

#1


4  

I figured this out with the help of Matt Hamilton. This actually works fine if you are using a regular TabControl (default Template).

我在Matt Hamilton的帮助下想出了这个。如果您使用常规TabControl(默认模板),这实际上工作正常。

I am using a xaml "theme" that alters the default control template. That is causing the layout to fail, so I will have to investigate and figure out what is wrong.

我正在使用改变默认控件模板的xaml“主题”。这导致布局失败,所以我将不得不调查并找出问题所在。

#2


0  

Nest a DockPanel in there, have you tried that?

在那里嵌入一个DockPanel,你试过吗?

Andrew

安德鲁

#1


4  

I figured this out with the help of Matt Hamilton. This actually works fine if you are using a regular TabControl (default Template).

我在Matt Hamilton的帮助下想出了这个。如果您使用常规TabControl(默认模板),这实际上工作正常。

I am using a xaml "theme" that alters the default control template. That is causing the layout to fail, so I will have to investigate and figure out what is wrong.

我正在使用改变默认控件模板的xaml“主题”。这导致布局失败,所以我将不得不调查并找出问题所在。

#2


0  

Nest a DockPanel in there, have you tried that?

在那里嵌入一个DockPanel,你试过吗?

Andrew

安德鲁