I want to display images in WPF, but using an actual image, instead of using the URL. The reason to this is because i want to Serialize images, so i can carry them around easily. How can i do this, if Image class is Source only? Which means, uses URI . The idea would be very simple: Serialize image, then, when deserialization done, it would load the image onto a controller like Image.
Is it even possible to, lets say i had the images serialized, then how could i even get their URI, even such a thing even exists? This is very confusing. Hope for some true enlightenment…
I already found many code snippets that show how to serialize/deserialize but honestly i haven’t been able to test them out yet, as the initial part of my plan is already on hold. Although, if anyone has a good clean link to it, i’d appreciate it!
WPF doesn’t require an actual URI; it requires an instance of
ImageSourceand it happens to include a built-in converter fromstringtoImageSourcethat interprets the string as a URI.The easiest way to convert your serialized format into an
ImageSourceinstance is to put something like the below in anIValueConverterand return theBitmapImage: