<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Silverlight Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx</link><description>Since Silverlight is based upon an asynchronized model, getting an image width and height immediately after loading it is not possible. However, you can monitor its download progress and obtain the image dimensions once the progress has reached 100%.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>presentão de Ano Novo: dúzias de dicas e tutoriais de Silverlight ;)</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#155379</link><pubDate>Sat, 03 Jan 2009 11:25:33 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:155379</guid><dc:creator>o UAU nosso de cada dia</dc:creator><description>&lt;p&gt;essa lista eu copiei desse blog b&amp;#225;rbaro (acompanhe por RSS voc&amp;#234; tamb&amp;#233;m): uma lista de dicas super &amp;#250;teis&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=155379" width="1" height="1"&gt;</description></item><item><title>Silverlight Tips of the Day - Summary Outline</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#155124</link><pubDate>Fri, 02 Jan 2009 22:56:49 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:155124</guid><dc:creator>Silverlight Tips of the Day - Blog by Mike Snow</dc:creator><description>&lt;p&gt;The purpose of this post is to create an outline summary all the blogs from my Silverlight tips of the&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=155124" width="1" height="1"&gt;</description></item><item><title>Quick Silverlight tip: Why my ActualWidth and ActualHeight equal 0? | Tamir Khason - Just code</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#154652</link><pubDate>Thu, 01 Jan 2009 08:54:00 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:154652</guid><dc:creator>Quick Silverlight tip: Why my ActualWidth and ActualHeight equal 0? | Tamir Khason - Just code</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Quick Silverlight tip: Why my ActualWidth and ActualHeight equal 0? | Tamir Khason - Just code&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=154652" width="1" height="1"&gt;</description></item><item><title>re: Silverlight Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#123663</link><pubDate>Mon, 03 Nov 2008 18:04:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:123663</guid><dc:creator>mike.snow</dc:creator><description>&lt;p&gt;Hard to say looking at your code. If you zip up a sample project, email it to msnow at microsoft.com I will take a quick look at it for you.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;--Mike&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=123663" width="1" height="1"&gt;</description></item><item><title>re: Silverlight Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#123572</link><pubDate>Mon, 03 Nov 2008 15:33:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:123572</guid><dc:creator>WzBn</dc:creator><description>&lt;p&gt;Hi, thanks for the data, but I'm try to useit in the way below, but the event &amp;nbsp;it is not fired.&lt;/p&gt;
&lt;p&gt;Do you have any suggestion?&lt;/p&gt;
&lt;p&gt;Thnaks in advance&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Private Sub UpdateBackground(ByVal mmImg As System.IO.MemoryStream)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim Img As New BitmapImage&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Img.SetSource(mmImg)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim imbck As New Image&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;AddHandler Img.DownloadProgress, AddressOf BckgDonloadProgress&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;With imbck&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Source = Img&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.HorizontalAlignment = HorizontalAlignment.Left&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.VerticalAlignment = VerticalAlignment.Top&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Stretch = Stretch.None&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;End With&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ThisPage.MainArea.Children.Add(imbck)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Catch ex As Exception&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ThisPage.ShowError(ex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Try&lt;/p&gt;
&lt;p&gt; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;Public Sub BckgDonloadProgress(ByVal sender As Object, ByVal e As DownloadProgressEventArgs)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If e.Progress = 1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim Wd, Hg As Double&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Wd = CDbl(CType(sender, BitmapImage).GetValue(Canvas.HeightProperty))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hg = CDbl(CType(sender, BitmapImage).GetValue(Canvas.WidthProperty))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If ScreenCollection(CurrentScreen).Width &amp;lt; Wd Then ScreenCollection(CurrentScreen).Width = Wd&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If ScreenCollection(CurrentScreen).Height &amp;lt; Hg Then ScreenCollection(CurrentScreen).Height = Hg&lt;/p&gt;
&lt;p&gt;end if&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Catch ex As Exception&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ThisPage.ShowError(ex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Try&lt;/p&gt;
&lt;p&gt; &amp;nbsp;End Sub&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=123572" width="1" height="1"&gt;</description></item><item><title>???????????????????????????? ???????? ?????????????????? ???????????????? ???????? - ?????????? - ???????????? ????.????</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#77428</link><pubDate>Tue, 05 Aug 2008 03:20:58 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:77428</guid><dc:creator>???????????????????????????? ???????? ?????????????????? ???????????????? ???????? - ?????????? - ???????????? ????.????</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;???????????????????????????? ???????? ?????????????????? ???????????????? ???????? - ?????????? - ???????????? ????.????&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=77428" width="1" height="1"&gt;</description></item><item><title>Quick Silverlight tip: Why my ActualWidth and ActualHeight equal 0?</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#70586</link><pubDate>Sat, 12 Jul 2008 08:22:03 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70586</guid><dc:creator>Just Code - Tamir Khason</dc:creator><description>&lt;p&gt;If you’ll try to use ActualWidth and ActualHight of controls with explicitly set Width and Height, you&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=70586" width="1" height="1"&gt;</description></item><item><title>Quick Silverlight tip: Why my ActualWidth and ActualHeight equal 0?</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#70585</link><pubDate>Sat, 12 Jul 2008 08:21:59 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70585</guid><dc:creator>Just code - Tamir Khason</dc:creator><description>&lt;p&gt;If you’ll try to use ActualWidth and ActualHight of controls with explicitly set Width and Height, you&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=70585" width="1" height="1"&gt;</description></item><item><title>re: Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#70499</link><pubDate>Fri, 11 Jul 2008 18:21:09 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70499</guid><dc:creator>mike.snow</dc:creator><description>&lt;p&gt;Rajeev- Yes, you may post. I added a link to your site from my &amp;quot;Silverlight Resources&amp;quot; section. Your site is great!&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=70499" width="1" height="1"&gt;</description></item><item><title>re: Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#70480</link><pubDate>Fri, 11 Jul 2008 17:40:19 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70480</guid><dc:creator>RajeevGoel</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;Great Tip of the Day. &amp;nbsp;I've been trying to figure out how to do this for a while now. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is it okay with you if I post this and other samples from your blog onto &lt;a rel="nofollow" target="_new" href="http://silverlightnuggets.com?"&gt;http://silverlightnuggets.com?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Rajeev&lt;/p&gt;
&lt;p&gt;rgoel@silverlightnuggets.com&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=70480" width="1" height="1"&gt;</description></item><item><title>re: Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#69081</link><pubDate>Tue, 08 Jul 2008 07:26:47 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:69081</guid><dc:creator>Guillaume Andre</dc:creator><description>&lt;p&gt;If you are in a Canvas you can also use SizeChanged event.&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=69081" width="1" height="1"&gt;</description></item><item><title>14 Silverlight Tips | DavideZordan.net</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#67277</link><pubDate>Wed, 02 Jul 2008 08:31:26 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:67277</guid><dc:creator>14 Silverlight Tips | DavideZordan.net</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;14 Silverlight Tips | DavideZordan.net&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=67277" width="1" height="1"&gt;</description></item><item><title>Sliverlight Cream for July 1, 2008 -- #315</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#67233</link><pubDate>Wed, 02 Jul 2008 06:29:04 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:67233</guid><dc:creator>Community Blogs</dc:creator><description>&lt;p&gt;16 posts today... yikes: Corrina Barber on Sparkling Client, Training CD update via Tim Heuer, Progressive&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=67233" width="1" height="1"&gt;</description></item><item><title>Silverlight Tips of the Day</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#67123</link><pubDate>Tue, 01 Jul 2008 22:44:36 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:67123</guid><dc:creator>Visual Web Developer Team Blog</dc:creator><description>&lt;p&gt;Interested in learning something new about Silverlight almost every day? I will be posting “Tips of the&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=67123" width="1" height="1"&gt;</description></item><item><title>re: Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.</title><link>http://blogs.silverlight.net/blogs/msnow/archive/2008/06/30/tip-of-the-day-13-getting-an-images-width-and-height.aspx#67071</link><pubDate>Tue, 01 Jul 2008 18:02:42 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:67071</guid><dc:creator>mike.snow</dc:creator><description>&lt;p&gt;Hey Rob, when you retreive an image from a web server you will be creating the image locally correct? At this time you add theDownloadProgress event and then get its size. I might, however, be reading your question wrong. If you send me some sample code (msnow@microsoft.com) I can take a look for you.&lt;/p&gt;
&lt;p&gt;As for your second question, until the image is actually added to the canvas it's not really loaded. I believe this is done to save memory and for better resource management. &lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=67071" width="1" height="1"&gt;</description></item></channel></rss>