相关疑难解决方法(0)

图像UriSource和数据绑定

我正在尝试将自定义对象列表绑定到WPF图像,如下所示:

<Image>
    <Image.Source>
        <BitmapImage UriSource="{Binding Path=ImagePath}" />
    </Image.Source>
</Image>
Run Code Online (Sandbox Code Playgroud)

但它不起作用.这是我得到的错误:

必须设置"Property'UriSource'或属性'StreamSource'."

我错过了什么?

.net data-binding wpf xaml

64
推荐指数
6
解决办法
13万
查看次数

图像渲染Win8/Win10但不是Win7

我的文档中有以下XAML:

<Border HorizontalAlignment="Right" VerticalAlignment="Bottom"
        Height="100" Width="100"
        BorderBrush="Red" BorderThickness="2">
    <Image x:Name="image"
           Source="http://myinternalserver/mywebservice/getimage.aspx?id=1234&amp;ContentType=Image" />
</Border>
Run Code Online (Sandbox Code Playgroud)

图像在Win10和Win8中显示得很好,但在Win7中,我得到的是一个透明背景的红色边框,里面没有图像.当我使用静态网址时,就像谷歌徽标一样,它会在所有版本中呈现.

任何人都知道如何在Windows 7中进行图像渲染?

c# wpf xaml windows-7

5
推荐指数
1
解决办法
122
查看次数

标签 统计

wpf ×2

xaml ×2

.net ×1

c# ×1

data-binding ×1

windows-7 ×1