あなたはItemsControl
/ListBox
を使用して、適切なWPFバインド可能なソリューションを実現するために、そのItemsPanel
として3x3の表示のためにUniformGrid
パネルを設定することをお勧めします。
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="3" Columns="3"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<Image Source="Images\img1.jpg" Width="100"/>
<Image Source="Images\img2.jpg" Width="50"/>
<Image Source="Images\img3.jpg" Width="200"/>
<Image Source="Images\img4.jpg" Width="75"/>
<Image Source="Images\img5.jpg" Width="125"/>
<Image Source="Images\img6.jpg" Width="100"/>
<Image Source="Images\img7.jpg" Width="50"/>
<Image Source="Images\img8.jpg" Width="50"/>
<Image Source="Images\img9.jpg" Width="50"/>
</ListBox>
ダイナミックなソリューションを探している場合は、イメージのコレクションをItemsSourceバインディングとして設定する必要があります。しかし、正確な答えを出すには問題が広すぎる。