首页 > 解决方案 > 图像在运行时不显示在 ListBox 中

问题描述

图像显示在 XAML 中,但是当我运行程序时,图像不会显示在列表框中。它只显示框但没有图像。

这是代码:

<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Hidden" Margin="103,156,67.6,65">
            <ListBox>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBoxItem>
                    <Image Margin="0,0,20,0" Width="225" Source="pictures/gw1.jpg"></Image>
                </ListBoxItem>
                <ListBoxItem>
                    <Image Margin="0,0,20,0" Width="225" Source="pictures/ja2.jpg"></Image>
                </ListBoxItem>
                <ListBoxItem>
                    <Image Margin="0,0,20,0" Width="225" Source="pictures/tj3.jpg"></Image>
                </ListBoxItem>
            </ListBox>
        </ScrollViewer>

标签: c#wpf

解决方案


推荐阅读