2016-11-10 90 views
0

我使用以下代码:编辑路径XAML

String filepath = e.fullpath; 
Image.source = new BitmapImage(new uri(filepath)); 

文件路径的输出是:

file:///c://Folder//Location//Name.jpg 

其投掷误差Image.Source

图片所需的路径格式:

c:/Folder/Location/name.jpg 

请帮帮忙,

预先感谢您

+0

@MongZhu我使用filewatcher被检索的路径。 – user5928466

+0

'filepath = filepath.Replace(“file:///”,“”);'? – Pikoh

+0

@Pikoh没有改变。我想将“//”更改为“/”。 – user5928466

回答

0

试试这个:

String filepath = e.fullpath; 
Image.source = new BitmapImage(new Uri(filepath).LocalPath);