SilverlightShow: Using the Image control in Silverlight Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: Using the Image control in Silverlight Hi, <span class="commentDetails"><a href="http://www.silverlightshow.net/Profile/weitzhandler.aspx" id="ctl00_cphMiddle_cphContent_modules_articles_article_ascx1_itemComments_dlstComments_ctl50_hlnkCommentAuthor">weitzhandler</a>!<br /> </span> <p>Silverlight still supports only PNG and JPG image formats. But I found an interesting post of Joe Stegman. It is about a parser that can import ico files in Silverlight applications. Here is a link to it: <a href="http://blogs.msdn.com/b/jstegman/archive/2009/09/13/silverlight-ico-icon-decoder-parser.aspx">http://blogs.msdn.com/b/jstegman/archive/2009/09/13/silverlight-ico-icon-decoder-parser.aspx</a> </p> <span class="commentDetails"></span> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment7590 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Mon, 27 Feb 2012 15:12:02 GMT Re: Using the Image control in Silverlight <p>Is *.ico supported as well?</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment7567 weitzhandler http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Wed, 22 Feb 2012 17:19:30 GMT Re: Using the Image control in Silverlight <p>hi </p> <p>I want to make selecting tool to select rectangle,circular,and free hand bath to select apart of image and copy it do you have any idea how can i do this </p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment7153 HawaDera http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 04 Nov 2011 23:59:52 GMT RE: Using the Image control in Silverlight 2 Thanks, very useful article and easily explained! http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment4075 Mujtaba http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Wed, 28 Jul 2010 10:23:18 GMT RE: Using the Image control in Silverlight 2 How to zoom/magnify window on mouse over.. http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment3538 Josh http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Wed, 05 May 2010 22:42:44 GMT RE: Using the Image control in Silverlight 2 how to save an image in an image control, where the control got the image dynamically. http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment3179 Jinesh http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Sat, 06 Mar 2010 11:06:17 GMT RE: Using the Image control in Silverlight 2 am doing image  slide show ........my task is put to play/pause buttons on images ........so the slideshow should wil start/pause...by clicking the button http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment2930 pavan http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 19 Jan 2010 15:21:52 GMT RE: Using the Image control in Silverlight 2 <p>Hi <span id="ctl00_cphMiddle_ContentPlaceHolderContent_itemComments_dlstComments_ctl34_lblCommentAuthor">Rob,</span></p> <p><span>Why are you diverting the post from technical to continent level.</span></p> <p><span></span></p> <p><span>Regards,</span></p> <p><span>Harry</span></p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment2706 Harry http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Mon, 23 Nov 2009 09:29:54 GMT RE: Using the Image control in Silverlight 2 Why doesn't Microsoft follow the convention of Visual Studio and allow developers to use VB.  I can do C# but it takes much more thought as I am a Visual basic guy... <p>-T</p> <br /> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment2619 T http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 03 Nov 2009 02:31:37 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>Thank you!</p> <p>This one is very helpful~</p> <p>Cheers</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment1061 Rhine http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Mon, 16 Feb 2009 21:14:37 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>It disgusts me the way any comments box on any technical site is used by every indian in the subcontinent to rudely ask how to perform some simple task. Research it or figure it out yourselves.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment905 Rob http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 13 Jan 2009 22:37:01 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>Do we have option to convert gif files to jpeg files dynamically inside our xaml.cs page?</p> <p>Thanks,</p> <p>Praveen</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment466 Praveen http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Mon, 29 Sep 2008 04:41:26 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>For the moment Silverlight has no support for gif images. Maybe in the next versions it will be possible, but for now we can only use jpeg and png formats.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment364 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 05 Sep 2008 04:53:31 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>Hi,</p> <p>Good post.</p> <p>What is solution for loading .gif images?</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment290 Baba http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Sun, 10 Aug 2008 23:43:00 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>Dil, yes, you can load image dynamically. Just set its source property as shown bellow:</p> <div> <div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span>myImage.Source = <span style="color: #0000ff;">new</span> BitmapImage( <span style="color: #0000ff;">new</span> Uri( <span style="color: #006080;">"GiantSeaTurtle.jpg"</span>, UriKind.Relative ) );</pre> </div> </div> <p>You can also change the source to another image, when you set it again. To do it in an exact period of time you should use timer. In Silverlight 2 you can create timer using the DispatcherTimer class. For this example I define it in the Page() constructor:</p> <div> <div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span><span style="color: #0000ff;">public</span> Page()</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span>{</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span> InitializeComponent();</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span> DispatcherTimer timer = <span style="color: #0000ff;">new</span> DispatcherTimer();</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span> timer.Interval = <span style="color: #0000ff;">new</span> TimeSpan( 0, 0, 1 ); <span style="color: #008000;">//the period is one second</span></pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span> timer.Tick += <span style="color: #0000ff;">new</span> EventHandler( Tick );</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span> timer.Start();</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span>}</pre> </div> </div> <div> </div> <div>The Tick event is raised every second now and in the event handler we can change the source of the image:</div> <div> <div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Tick( <span style="color: #0000ff;">object</span> sender, EventArgs e )</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span>{</pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: white;border-style: none;"><span style="color: #606060;"> </span> <span style="color: #008000;">//Change the image source here</span></pre> <pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: visible; overflow-y: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'courier new', courier, monospace; background-color: #f4f4f4;border-style: none;"><span style="color: #606060;"> </span>}</pre> </div> </div> <p>In this event you should place your logic for changing the images. Here is a demo and if you're interested you can see the source code <a href="http://www.silverlightshow.net/storage/userfiles/DispatcherTimerSample.zip">here</a>.</p> <div id="silverlightControlHost" style="width: 200px; height: 180px;"><object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" width="100%" height="100%"> <param name="source" value="http://www.silverlightshow.net/showcase/DispatcherTimerSample/DispatcherTimerSample.xap"> <param name="onerror" value="onSilverlightError"> <param name="background" value="white"> <a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"> </a> </object> <iframe style="border:0px none; visibility: hidden; height: 0pt; width: 0pt;"></iframe></div> <p>In Silvester Emil also uses a timer to update the data in exact periods of time, if you are interested take a look at <a href="http://www.silverlightshow.net/items/Silvester-A-Silverlight-Twitter-Widget.aspx">his article</a> too.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment223 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Mon, 07 Jul 2008 02:28:58 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>how can i load different images(one after other) dynamically in a single image control with a period of time.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment220 dil http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 04 Jul 2008 01:29:22 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>how can i load image dynamically in a single image control</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment219 dil http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 04 Jul 2008 01:14:42 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>As far as I know, Silverlight doesn't support .gif files yet.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment207 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 01 Jul 2008 05:34:31 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p>Does Silverlight support .gif image files? I can display png and jpg files but having trouble with gifs. Any help appreciated.</p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment190 Rupak Ganguly http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 24 Jun 2008 09:51:09 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p class="MsoNormal">Vikram, if you try to set the source of the image to a URL in the codebehind file it won’t work. In order to set the Image control’s source dynamically you should use a BitmapImage. Here is a sample code:</p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; color: green; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">// The name of our Image control is MyImage. We will use the <br /></span><span style="font-size: 10pt; color: green; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">// BitmapImage class and its UriSource property to set the path to the <br /></span><span style="font-size: 10pt; color: green; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">// desired image. The image path can be passed as parameter. <br /></span><span style="font-size: 10pt; color: #2b91af; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">BitmapImage</span><span style="font-size: 10pt; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier"> myImage = <span style="color: blue">new</span> <span style="color: #2b91af">BitmapImage</span>(); <br /></span><span style="font-size: 10pt; color: blue; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">string</span><span style="font-size: 10pt; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier"> imagePath = <span style="color: #a31515">"/Images/SampleImage.jpg"</span>; <br /></span><span style="font-size: 10pt; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">myImage.UriSource = <span style="color: blue">new</span> <span style="color: #2b91af">Uri</span>( imagePath, <span style="color: #2b91af">UriKind</span>.Relative ); <br /></span><span style="font-size: 10pt; line-height: 115%; font-family: " yes?="yes?" mso-no-proof:="mso-no-proof:" new?;="new?;" courier="courier">MyImage.Source = myImage;</span></p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment134 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Thu, 22 May 2008 10:17:00 GMT RE: Using the Image control in Silverlight 2 Beta 1 Hi, How do I load the image if I just know the relative path of the image at runtime. for example, if all my images are in applicationpath\images folder and I get the image name as the parameter to the silverlight application, I should be able to check if the image exists and then load the image. Regards Vikram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment129 Vikram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Wed, 14 May 2008 12:39:42 GMT RE: Using the Image control in Silverlight 2 Beta 1 Hi Enrai, I have a World Map Image. On Selecting a country in the dropdown, I need to highlight the country or the particular co-ordinates by blinking it or doing any of the animations. Can you help me on this? Thanks, Rajah http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment127 rajahram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 13 May 2008 20:49:31 GMT RE: Using the Image control in Silverlight 2 Beta 1 Many Thanks Enrai!!!!!! :) http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment126 rajahram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 13 May 2008 03:03:59 GMT RE: Using the Image control in Silverlight 2 Beta 1 <p class="MsoNormal">To do that you must know the coordinates of the region of each country on the image. This is the hardest part and it is out of this article’s scope. You need to create a handler for the MouseMove event of the image. In it you should get the position of the pointer and find to which country they correspond. Then you can use a TextBlock control to display the country name and use the Top and Left properties to position it. Here is an example handler:</p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">private</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> <span style="color: blue">void</span> MyImage_MouseMove( <span style="color: blue">object</span> sender, <span style="color: #2b91af">MouseEventArgs</span> e )<?xml:namespace prefix = o /><o:p></o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">// You have to create a function that returns the name of the country based on the coordinates of the mouse, for example GetCountryName()</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0pt; text-indent: 0.5in; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">TextBlock.Text = GetCountryName( e.GetPosition( MyImage ) );<span style="mso-tab-count: 3">                  </span><o:p></o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes">            </span><o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">// Use methods of the layout control that contains the TextBlock to position it. </span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes">      </span><span style="color: #2b91af">Canvas</span>.SetTop( TextBlock, e.GetPosition( MyImage ).Y );<br></span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes">      </span><span style="color: #2b91af">Canvas</span>.SetLeft( TextBlock, e.GetPosition( MyImage ).X );<o:p></o:p></span></p> <p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; mso-no-proof: yes">}</span></p> http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment123 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 09 May 2008 04:14:49 GMT RE: Using the Image control in Silverlight 2 Beta 1 I need to display a world map. I should display the name of the country on keeping the mouse pointer over the country. Can you please help me? http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment117 rajahram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Wed, 07 May 2008 00:52:27 GMT RE: Using the Image control in Silverlight 2 Beta 1 I guess you are using a Web site to host your Silverlight application. Look in your project's directory, there are two folders - one for the Silverlight application and one for the Web site. In the Web site folder there is also a ClientBin directory, which also contains a .xap file. The Web site uses this file, not the one in the Silverlight application folder, where your images are. Simply create a folder for the images in the Web site directory too. http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment109 Enrai http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Tue, 29 Apr 2008 00:33:46 GMT RE: Using the Image control in Silverlight 2 Beta 1 Hi Martin, I have My Image in the following folder. C:\Projects\Map\Map\ClientBin\Images My code is: <Grid x:Name="LayoutRoot" Background="White"> <Image x:Name="MyImage" Source="/Images/timezone_bckgrnd.jpg" Stretch="Fill"></Image> </Grid> But the Image is not getting visibled in the screen. Also there is another ClientBin folder in the path C:\Projects\Map\Map_Web\ClientBin\Images Please let me know in which folder do I need to place the Image. Please help me on this issue. Thanks, Rajah http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx#comment108 rajahram http://www.silverlightshow.net/items/Using-the-Image-control-in-Silverlight-2-Beta-1.aspx Fri, 25 Apr 2008 22:44:01 GMT