谁能告诉我怎样从资源XAML中设置源图像。 目前,我有
<Image x:Name="img" Panel.ZIndex="1" Source="D:\Img100.jpg" Stretch="Uniform"/>
我想被来自资源图像源。
谢谢。
谁能告诉我怎样从资源XAML中设置源图像。 目前,我有
<Image x:Name="img" Panel.ZIndex="1" Source="D:\Img100.jpg" Stretch="Uniform"/>
我想被来自资源图像源。
谢谢。
首先,你必须包括在项目中的图像BuildAction的 Resource
然后你就可以在你的图片直接使用它
<Image Source="Img100.jpg"/>
或使图像的可重复使用的资源
App.xaml中(或其他资源字典)
<Application.Resources>
<BitmapImage x:Key="myImage" UriSource="Img100.jpg" />
</Application.Resources>
元件:
<Image Source="{StaticResource myImage}" />