Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在silverlight(4)网格中显示图像_Silverlight_Image_Data Binding_Silverlight 4.0_Binding - Fatal编程技术网

在silverlight(4)网格中显示图像

在silverlight(4)网格中显示图像,silverlight,image,data-binding,silverlight-4.0,binding,Silverlight,Image,Data Binding,Silverlight 4.0,Binding,我是silverlight的新手,现在正在尝试。 我有以下xaml: <Grid Background="#FF06EFEF" Width="280"> <Border BorderBrush="#FF000000" BorderThickness="1" Width="auto" Height="90"> <StackPanel> <TextBlock x:Name="denaam" TextWrapping="Wrap" W

我是silverlight的新手,现在正在尝试。 我有以下xaml:

<Grid Background="#FF06EFEF" Width="280">

  <Border BorderBrush="#FF000000" BorderThickness="1" Width="auto" Height="90">
    <StackPanel>
      <TextBlock x:Name="denaam" TextWrapping="Wrap" Width="auto" Text="{Binding Naam}" />
      <Image  x:Name="MyImage"  Width="40" Height="40"  Source="{Binding Foto}"></Image>
      <TextBlock x:Name="denaam2" TextWrapping="Wrap" Width="auto" Text="{Binding Foto}" />
    </StackPanel>
  </Border>
</Grid>

如您所见,TextBlock绑定到对象的两个属性(props Naam和Foto)

现在Naam和Foto都显示在文本块中,但Foto仅显示为文本(因为它是文本块)

现在我想要Foto(它包含一个像这样的url'http://www.megomuseum.com/teevee/images/robot.jpg“)作为图像的源,因此显示图片

希望我说清楚:)

因此数据是绑定的,因为道具是显示的,但是图像控件什么也没有显示。

请查看帖子。在这里,您将了解如何将url正确绑定到图像。

也将对您有所帮助。

图像中源的绑定类型必须是ImageSource类型。位图属性是执行此操作的常用方法,或者使用值转换器,该转换器接受字符串并返回ImageSource。

ah!太多asp.net,只需将字符串设置为源:-)谢谢您的帮助,这很有效。