2017-09-02 46 views
0

我有一个画布内的选项卡控件。我如何让TabControl使用其父项的全部宽度?如何获取TabControl以在wpf中使用其父项的完整宽度?

<UserControl 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="SilverlightApplication1.MainPage" 
mc:Ignorable="d" 
d:DesignHeight="300" d:DesignWidth="400"> 

<Canvas x:Name="LayoutRoot" Background="White" Margin="0,0,0,0"> 
    <sdk:TabControl Width="400" Height="300" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="0,0" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" > 
     <sdk:TabItem Header="myResponse"> 
      <Grid Background="#FFE5E5E5"/> 
     </sdk:TabItem> 
     <sdk:TabItem Header="TabItem"> 
      <Grid Background="#FFE5E5E5"/> 
     </sdk:TabItem> 
    </sdk:TabControl> 

+1

为什么你首先使用''? – Dai

回答

相关问题