Silverlight 4:数据模板中的图像未出现在设计图面上
|
我正在尝试将图像的源绑定到带有数据模板的列表框中的字符串。
运行应用程序时,我在浏览器中看到了图像,但是在设计图面上看不到它。
有任何想法吗?
我创建了一个带有3行网格的示例用户控件。
在第0行中,我只是将图像
在第一行中,我将图像放入列表框项
在第2行中,我将图像放入绑定到资源的列表框中的数据模板中
在设计图面上,我可以在第0行和第1行看到图像,但在第2行看不到图像。
public class PersonCollection : List<Person>
{
}
public class Person
{
public string Name { get; set; }
public string PictureURL { get; set; }
}
<Grid x:Name=\"LayoutRoot\" Background=\"White\">
<Grid.Resources>
<mystuff:PersonCollection x:Key=\"PersonList\">
<mystuff:Person Name=\"Rick\" PictureURL=\"abc.jpg\"/>
<mystuff:Person Name=\"Bob\" PictureURL=\"abc.jpg\"/>
</mystuff:PersonCollection>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Source=\"abc.jpg\"/>
<ListBox Grid.Row=\"1\">
<ListBoxItem>
<StackPanel Orientation=\"Horizontal\">
<Image Source=\"abc.jpg\"/>
</StackPanel>
</ListBoxItem>
</ListBox>
<ListBox Grid.Row=\"2\" ItemsSource=\"{StaticResource PersonList}\">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source=\"{Binding PictureURL}\"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
没有找到相关结果
已邀请:
2 个回复
砷竣阿
蹄寄噬非芹