问题描述
在最大化窗口之后内部嵌套的tabcontrol无法自动拉伸,求大神指点迷津。代码如下:<Grid><TabControlx:Name="tabControl"TabStripPlacement="Left"Margin="0,0,0,0"FontFamily="TimesNewRoman,黑体"HorizontalAlignment="Stretch"VerticalAlignment="Stretch"><TabItemHeader="格式预处理"FontWeight="Bold"><GridBackground="#FFE5E5E5"Margin="0,0,0,0"><TabControlx:Name="tabControl1"HorizontalAlignment="Stretch"Height="418"Margin="0,0,0,0"VerticalAlignment="Stretch"Width="475"TabStripPlacement="Top"><TabItemHeader="MaxQuant"FontWeight="Normal"><GridBackground="#FFE5E5E5"><CheckBoxx:Name="MaxQuant_checkbox"Content="SplitAccession"HorizontalAlignment="Left"Margin="18,18,0,0"VerticalAlignment="Top"/><Buttonx:Name="MaxQuantbutton"Content="Process"HorizontalAlignment="Left"Margin="265,18,0,0"VerticalAlignment="Top"Width="75"/></Grid></TabItem></TabControl></Grid></TabItem></TabControl></Grid>
解决方案
解决方案二:
给最外层Grid起个名字A,可以设置TabControl的尺寸为绑定,比如:Width={BindingActualWidth,ElementName=A}
解决方案三:
设置一下dock属性
解决方案四:
Removeanyattributesregardngthetabcontrolwidth,height,oralignment.Thatshouldtakecareofit