WARNING There are two different ImageSource
s in Windows API
I'm a beginner in C# and Windows 8 Metro Style App programming stuff.
But if you want to edit the image of a Image
, the "old" method with BitmapImage won't work:
XAML:
<Image Source="http://image.source.de" x:Name="Image1" />
Code-Behind C#:
Image1.Source = new BitmapImage...
won't work. The compiler will say something like
"System.Windows.Media.Imaging.BitmapImage" can't be converted to "Windows.Ui.Xaml.Media.ImageSource"
(Yes,
BitmapImage
can usually be converted toSystem.Windows.Media.ImageSource
)
(System.Windows.Media.Imaging isn't anymore in the default import list of Visual Studio for Windows (StoreApps), you need to bind PresentationCore.dll first.)
So - is there any solution to edit Image1.Source than using Binding
s?
这应该工作。
Image.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new System.Uri("http://image.source.de"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.