krr*_*hna 1 c# windows-phone-7 windows-phone windows-phone-8 windows-phone-8.1
我有一个属性为BitmapImage的模型,我试图从root - > Assets - > Icons文件夹加载和映像,并将其设置为此属性.但总是给我错误"无效的URI:无法确定URI的格式." 我们最初在WP8.0中创建了这个项目,然后将其定位到8.1
BitmapImage bi = new BitmapImage();
bi.UriSource = new Uri(@"../Assets/Icons/noprofilepic.png", UriKind.RelativeOrAbsolute);
bi.CreateOptions = BitmapCreateOptions.BackgroundCreation;
BuddyImage = bi;
Run Code Online (Sandbox Code Playgroud)
财产定义为:
private BitmapImage _BuddyImage;
public BitmapImage BuddyImage
{
get { return _BuddyImage; }
set { _BuddyImage = value; RaisePropertyChanged("BuddyImage"); }
}
Run Code Online (Sandbox Code Playgroud)
xaml控件如下所示
<Image Source="{Binding BuddyImage}" Width="75" Height="75" Stretch="Uniform"/>
Run Code Online (Sandbox Code Playgroud)
小智 5
使用ms-appx:///例如:
bi.UriSource = new Uri("ms-appx:///Assets/Icons/noprofilepic.png");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3558 次 |
| 最近记录: |