GPWiki.org
GPWiki.org
It is currently Wed May 22, 2013 6:25 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Aug 03, 2012 1:26 am 
Ankle Nibbler
User avatar

Joined: Tue Dec 20, 2005 12:28 am
Posts: 140
In a silverlight app, I have a BitmapImage defined as System.Windows.Media.Imaging.BitmapImage and it as a method called "SetSource" where I can set the source like this:

Code:
   BitmapImage bitmap = new BitmapImage();
   System.IO.Stream stream = _scene.GetStream();
   if (stream == null) return;
   bitmap.SetSource(stream);

In a WPF application I have also have a Bitmap image defined as System.Windows.Media.Imaging.BitmapImage but there is no SetSource method. How do I set the source in a WPF app like I do in a Silverlight app?

Also, it is a stream, not a string. It is not a URI. so "UriSource" method does not work. I tried this:

Code:
    System.IO.Stream stream = _scene.GetStream();
        if (stream == null) return;
        BitmapImage bitmap = new BitmapImage();
 
        bitmap.UriSource = new Uri(stream.ToString());


And at runtime, it threw an error tha URI cannot be determined. Is the URI an identifier for the intranet? Are you sure that this is not a silverlight thing? I am doing a WPF application


Top
 Profile  
 
PostPosted: Sat Aug 04, 2012 1:09 am 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
Like this?
Code:
System.IO.Stream stream = _scene.GetStream();
BitmapImage image = new BitmapImage();
image.StreamSource = stream;

The UriSource is for loading the image from a filepath or a url to an image online.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group