Is there a way to get the original image size in terms of width and height of a png image that is loaded in an image control?
A:
How about - in your code behind file (.xaml.cs) reload the image into a new image control and take the width and height from that?
Something like this:
System.Windows.Controls.Image img = new System.Windows.Controls.Image();
string UriValue = HtmlPage.Document.DocumentUri.AbsoluteUri + imagefilename;
img.SetValue(System.Windows.Controls.Image.SourceProperty,
new System.Windows.Media.Imaging.BitmapImage(new Uri(UriValue)));
double imagewidth = img.Width;
BPerreault
2009-04-14 18:20:39
Tried that but doesnt find the sizes straight away
Drahcir
2009-04-19 19:36:16
A:
I have downloaded silverlight 3 beta which provides the event ImageOpened which has arguments that can show the actual image dimentions
Drahcir
2009-05-03 09:02:53