c# - Why is my image being displayed larger? -


i'm trying display image on splash screen , it's being stretched upon display. image i'm trying display simple bmp file. ideas why?

in splashwindow.xaml:

<window ... sizetocontent="widthandheight">   <grid>     ...     <image grid.row="0" source="{binding splashimage}"></image>   </grid> </window> 

in splashviewmodel.cs

public imagesource splashimage {     {     return imageutilities.getimagesource(_splashimagefilenamestring);   } } 

from imageutilities.cs

public static imagesource getimagesource(string imagefilename) {   bitmapframe bitmapframe = null;    if(!string.isnullorempty(imagefilename))   {     if(file.exists(imagefilename))     {       bitmapframe = bitmapframe.create(new uri(imagefilename));     }     else     {       debug.assert(false, "file " + imagefilename + " not exist.");     }   }   return bitmapframe; } 

in xaml, set "stretch" property "none" (i believe defaults "fill"):

<image grid.row="0" source="{binding splashimage}" stretch="none"></image> 

you can explicitly set width , height properties if like.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -