我想在水平模式下使用滚动选项在ListBox中显示集合中的图像。如果我明白了这一点(不滚动),则图像将垂直显示。
<ListBox x:Name="SelectedImages" ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image2}" Height="110" Width="110" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
如果尝试此操作,则会出现黑屏。
<ListBox x:Name="SelectedImages" ItemsSource="{Binding}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image2}" Height="110" Width="110" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ListBox x:Name="SelectedImages" ScrollViewer.HorizontalScrollBarVisibility="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image2}" Height="110" Width="110" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句