谁能解释如下的代码啊
terrylee中,ListBox项水平放置代码如下,代码是对的,效果也是对的.
<ListBox>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal">
</StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem Content="1" Width="40"/>
<ListBoxItem Content="2" Width="40"/>
<ListBoxItem Content="3" Width="40"/>
<ListBoxItem Content="4" Width="40"/>
</ListBox>
但我不清楚为什么不是这样的形式:
<ListBox>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal">
<ListBoxItem Content="1" Width="40"/>
<ListBoxItem Content="2" Width="40"/>
<ListBoxItem Content="3" Width="40"/>
<ListBoxItem Content="4" Width="40"/>
</StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
另