【发布时间】:2013-01-09 15:52:39
【问题描述】:
我有一个按钮,它调用一个方法,该方法用图像路径填充List<string>。每次调用此方法以显示所有生成的图像时,我都会尝试更新 Windows 8 应用程序。
目前它不会显示任何内容,尽管只是将图像路径硬编码到List<string>
我显示图像的 XAML 代码是:
<ItemsControl ItemsSource="{Binding Path=test}" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="5"
HorizontalContentAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
在 Xaml.cs 中:
public sealed partial class MainPage : TestApp.Common.LayoutAwarePage
{
public List<string> test = new List<string>();
public MainPage()
{
test.Add("C:\\Users\\user\\Pictures\\image.jpg");
this.InitializeComponent();
}
}
我做错了什么/需要在这里更改?非常感谢:)。
【问题讨论】: