我试图将图像的源代码绑定到带有数据模板的列表框中的字符串。Silverlight 4:datatemplate中的图像未出现在设计图面
当我运行该应用程序时,我在浏览器中看到图像,但在设计图面上看不到它。
任何想法?
我用3行网格创建了一个示例用户控件。 在0行i只是把图像 在行1我把图像划分为列表框项目 在第2行我把图像划分成一个DataTemplate在绑定到资源
在设计表面上的列表框,我可以见行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>
我说的是VS Web Developer速成SP1 IDE,而不是混合 – 2011-06-13 20:32:49