ItemsPanelが15 * 15の均一なグリッドであるItemsControlを作成するXAMLのカスタムユーザーコントロールがあります。 ItemsControlには起動時にCellが設定されます。カスタムユーザーコントロールのItemsControlの子を2次元配列にバインドする方法WPF C#?
<UserControl x:Class="Words.GameBoard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Words="clr-namespace:Words"
xmlns:Cell="Words.CellCollection"
xmlns:CellTile="Words.Cell"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<Words:CellCollection x:Key="CellCollectionData">
</Words:CellCollection>
<Style TargetType="ItemsControl">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid IsItemsHost="True" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Words:Cell>
</Words:Cell>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<ItemsControl Name="BoardControl">
</ItemsControl>
コントロールは、私は配列へのItemsControlの項目をバインドするにはどうすればよいこの
<clr:GameBoard>
</clr:GameBoard>
のようにメインウィンドウに追加されますか? Observablesやものは必要ありません。ボタンをクリックするとアイテムが更新されます。これは可能ですか?私は両方のC#とXAMLに非常に新しいまし
おかげ