私はWPF経由でグリッドを構築しています。グリッドの上に表示する行、バー、または何かを追加する必要があります。グリッドの上に表示されるものは、コードによって読み込まれるいくつかのテキスト項目があります。私は道具を使っていましたが、既存の(そして作業中の)グリッドの上に別のパネルを配置する方法を見つけることができません。これは私のコードです:アイテムのグリッドの上にテキストの行を追加する
<Window x:Class="GridWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Board" SizeToContent="WidthAndHeight" Height="Auto" Width="Auto">
<Window.Resources>
<DataTemplate x:Key="DataTemplate_2">
<Button Content="{Binding}" Height="25" Width="25" Margin="0,0,0,0"/>
</DataTemplate>
<DataTemplate x:Key="DataTemplate_1">
<ItemsControl ItemsSource="{Binding}" ItemTemplate="{DynamicResource DataTemplate_2}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DataTemplate>
</Window.Resources>
<Grid Name="GridBoard" ShowGridLines="True">
<ItemsControl x:Name="GridItems" ItemTemplate="{DynamicResource DataTemplate_1}"/>
</Grid>
</Window>
GridItemsは、ギザギザの配列によって読み込まれ、表示されます。ボックスの上にいくつかのテキストオブジェクトを置くか、グリッドの幅に合った水平のパネルだけを置くだけです。