2015-02-09 63 views

回答

1

允許在XAML文件中的Image,如:

 <Image Name="img"/> 

現在,從資產分配的source在代碼文件,如:

 img.Source = new BitmapImage { UriSource = new Uri("/Assets/text1.png", UriKind.Relative) }; 

完蛋了。

+0

'System.ArgumentException'類型的異常 給定的System.Uri無法轉換爲Windows.Foundation.Uri。 – 2015-02-09 08:56:32

+0

使用替換或絕對的替換或相對URI 'Flag.Source = new BitmapImage {UriSource = new Uri(「ms-appx:/// Flags /」+ Flags.list [flagIndex] .filename +「.png」,UriKind .Absolute)};' 它像一個魅力。 非常感謝您回答這樣的原始問題。 – 2015-02-09 09:02:46

相關問題