絕對路徑:
代碼 BitmapImage image = new BitmapImage(new Uri("E:\\Project\\xxx.png", UriKind.Absolute));
imgName.source = image;
xaml: <Image Name="imgName" SourceE:\\Project\\xxx.png">
相對路徑:
1) :引用其他程序集的資源
<Image Name="tb_1" Source="/Yiou.Hospital.Platform.Resource;Component/Image/ToLeft.png">
"/Yiou.Hospital.Platform.Resource; 其他程序集的名稱
Component 固定寫法
2)項目下的目錄
imgName.Source = new BitmapImage(new Uri(pack://application:,,,/Resources/aa.jpg));
pack://application:,,,這個也是固定寫法,imgName.Source = new BitmapImage(new Uri(/aa.jpg));不用顯式的寫出,會自動加上
還有其他的綁定方法,可以綁定流,以后添加
