In WPF, how do I get the content of a tabItem to fill available space?

十年热恋 提交于 2020-01-14 11:46:40

问题


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?

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

回答1:


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

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.




回答2:


Nest a DockPanel in there, have you tried that?

Andrew



来源:https://stackoverflow.com/questions/819520/in-wpf-how-do-i-get-the-content-of-a-tabitem-to-fill-available-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!