为什么我不能在一个窗口上放置多个控件?

0 c# wpf xaml

问题:

Visual Studio 设计器中的问题

XAML 文件:

<Window
        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:local="clr-namespace:WpfApp1"
        xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="WpfApp1.MainWindow"
        mc:Ignorable="d"
        Title="Test" Height="398.775" Width="782" BorderBrush="Black" Margin="0" IsTabStop="True">
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo/>
    </Window.TaskbarItemInfo>
    <TextBox HorizontalAlignment="Left" Height="23" Margin="268,290,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
</Window>

Run Code Online (Sandbox Code Playgroud)

tha*_*guy 6

AWindow是一个ContentControl。它们具有Content显示单个项目的属性。如果要显示多个项目,请使用以下内置用户界面面板之一并将它们拖到您的窗口中。然后您可以向它们添加多个控件。