我在设计中添加了一个标签控件和一个标签项,并希望将3个停靠面板水平放置到此标签页中。但是我收到了一个错误:
属性'内容'设置不止一次。
我想要一个如下设计。
TabItem1
PersonalInformationArea ------ LocationInformations ------ EducationInformations
名称:TextBox1 ---------------城市:TextBox3 ------------学校:TextBox5
姓:Textbox2 ------------国家:TextBox4
我该如何设计?
<TabControl>
<TabItem Header="Ana Bilgiler">
<DockPanel x:Name="dpMainInformations" LastChildFill="False" Width="230">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,5,5,5">
<TextBlock Text="Müşteri Bilgileri" FontWeight="Bold" HorizontalAlignment="Stretch" Width="200"></TextBlock>
</StackPanel>
<StackPanel x:Name="CustName" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,5,5,5">
<TextBlock Name="lblCustName" Text="Müşteri adı" Width="100"/>
<TextBox x:Name="txtMusteriAdi" Width="100" Text="{Binding CustName}" IsReadOnly="{Binding IsControlsEditable}"/>
<Button x:Name="btnSelectCust" Content="Seç" Click="Button_Click_5" IsEnabled="{Binding IsControlsEditable}"/>
</StackPanel>
</DockPanel>
<DockPanel LastChildFill="False" Margin="20,5,12,5">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,5,0,5">
<TextBlock Text="Uygunsuzluk Bilgileri" FontWeight="Bold"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,0,0,5">
<TextBlock Name="lblProblemDesc" Text="Tanımı" Width="60"/>
<TextBox MinWidth="150" MaxLength="500" Text="{Binding Definition}" UndoLimit="500" VerticalAlignment="Stretch" TextWrapping="Wrap" AcceptsReturn="True" MinLines="4" MaxWidth="200" Margin="0,0,0,0" IsReadOnly="{Binding IsControlsEditable}" Height="40" Width="300"/>
</StackPanel>
</DockPanel>
</TabItem>
<TabItem Header="Kapanma Bilgileri">
</TabItem>
</TabControl>
答案 0 :(得分:0)
您需要将DockPanel
放在容器面板中,因为TabItem
只能有一个子元素,如错误消息所示。
E.g。如果您希望3个停靠面板的大小相同,则可以使用UniformGrid
:
<TabItem>
<UniformGrid Columns="3">
<DockPanel>
...
<DockPanel/>
<DockPanel>
...
<DockPanel/>
<DockPanel>
...
<DockPanel/>
</UniformGrid>
</TabItem>