<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ganshani.com</title>
	<atom:link href="http://www.ganshani.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ganshani.com</link>
	<description>Puneet Ghanshani - .NET, Silverlight, Sharepoint Articles, Blogs, Poems, Photograph</description>
	<lastBuildDate>Sat, 24 Apr 2010 10:17:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Parallel Programming in .NET 4.0</title>
		<link>http://www.ganshani.com/2010/04/24/parallel-programming-in-net-4-0/</link>
		<comments>http://www.ganshani.com/2010/04/24/parallel-programming-in-net-4-0/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 10:16:23 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[NET 4.0]]></category>
		<category><![CDATA[Parallel]]></category>
		<category><![CDATA[TPL]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=575</guid>
		<description><![CDATA[
			
				
			
		
Which machine do you have? Intel Core 2 Duo, Quad Processor, AMD Turion?
All these machines and many more in the market are multi-core machines, but not all your software programs are! So eventually you do not get the best out of your software even if you have spent more money behind buying a multi-core processor!
So [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F24%2Fparallel-programming-in-net-4-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F24%2Fparallel-programming-in-net-4-0%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Which machine do you have? Intel Core 2 Duo, Quad Processor, AMD Turion?</p>
<p>All these machines and many more in the market are multi-core machines, but not all your software programs are! So eventually you do not get the best out of your software even if you have spent more money behind buying a multi-core processor!</p>
<p>So why don&#8217;t we design our software programs to use multi-core architecture and speed up the processing and deliver faster &amp; better results?  Yes, it becomes little complex if you were to write code considering different threads, their joining at right time and thread-safety (something you and I did until now)! But .NET 4.0 looks more promising considering the Parallel Programming using Task Parallel Library (TPL) or now called as Parallel API</p>
<p>With Parallel API, you can direct .NET 4.0 compiler to execute the <em>core processing </em>in parallel i.e. execute it on a different core-processor.  This means, on a Dual Processor with Parallel API you can expect <strong>twice better</strong> performance and with a Quad Processor with Parallel API the performance could be <strong>four times better</strong>!</p>
<h2>Sounds good, isn&#8217;t it?</h2>
<p>So, let&#8217;s have a very small example of using Parallel API. Say we want to generate a single-dimensional array with the some non-dependent logic. The term &#8216;<em>non-dependent</em>&#8216; refers to a scenario where there is no data dependency between values at 2 indices of the array. In simpler words, array[x] is not dependent on value of array[y] so that computation of array[x] and array[y] can happen in parallel.</p>
<p><strong>Traditional Code:</strong></p>
<pre class="brush: c#">
int size = 1000;
for (int i = 0; i &lt; size; i++)
{
Thread.Sleep(10);
}
</pre>
<p><strong>With Parallel API:</strong></p>
<pre class="brush: c#">
Parallel.For(0, size, delegate(int i)
{
Thread.Sleep(10);
});
</pre>
<h2>Check the performance!</h2>
<p>Performance Environment:</p>
<ul>
<li>Intel Core 2 Duo 2.1 GHz</li>
<li>2 GB RAM</li>
<li>Windows 7</li>
</ul>
<p>With 1000 iterations each having a sleep duration of 10 Milli-Seconds, the execution time was</p>
<p><strong>Traditional Code: </strong>10.007 seconds<br />
<strong>Parallel API Code: </strong>2.93 seconds</p>
<p>This clearly depicts that Parallel API fastens the execution time. But wait!</p>
<p>In the examples taken above, there was no particular sequence that got executed.  In case we want a particular sequence to be executed in the core processing then Parallel API does not help us much.  We need to get to our basics of Threads and Delegates to ensure appropriate sequencing.</p>
<p>Looking at features &amp; faster executing speed as offerings from Parallel API, I am sure .NET 4.0 will get accepted as a standard language for new / re-engineering applications. Many more migration projects to come! <img src='http://www.ganshani.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/04/24/parallel-programming-in-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweet from my site</title>
		<link>http://www.ganshani.com/2010/04/24/tweet-from-my-site/</link>
		<comments>http://www.ganshani.com/2010/04/24/tweet-from-my-site/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 09:34:56 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=573</guid>
		<description><![CDATA[
			
				
			
		
Now you can tweet each post directly from my website www.ganshani.com
Integrated TweetMeMe Button with my site. So keep tweeting my posts on your Twitter account directly  
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F24%2Ftweet-from-my-site%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F24%2Ftweet-from-my-site%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Now you can tweet each post directly from my website www.ganshani.com</p>
<p>Integrated TweetMeMe Button with my site. So keep tweeting my posts on your Twitter account directly <img src='http://www.ganshani.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/04/24/tweet-from-my-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webinar: Features of .NET 4.0</title>
		<link>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/</link>
		<comments>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 18:56:21 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=570</guid>
		<description><![CDATA[
			
				
			
		
Today, I delivered a Webinar on &#8216;Features of .NET 4.0&#8216;
Total duration of webinar: 1 hour
Total participants: 200
Take away from the session:

Features of .NET 4.0
Optimizations in .NET 4.0 vs .NET 3.5
New look of WCF in .NET 4.0
New in Silverlight 4.0

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F18%2Fwebinar-features-of-net-4-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F18%2Fwebinar-features-of-net-4-0%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today, I delivered a Webinar on &#8216;<strong>Features of .NET 4.0</strong>&#8216;</p>
<p><strong>Total duration of webinar:</strong> 1 hour<br />
<strong>Total participants: </strong>200</p>
<p><strong>Take away from the session:</strong></p>
<ul>
<li>Features of .NET 4.0</li>
<li>Optimizations in .NET 4.0 vs .NET 3.5</li>
<li>New look of WCF in .NET 4.0</li>
<li>New in Silverlight 4.0</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web 2.0 and Cloud Computing</title>
		<link>http://www.ganshani.com/2010/04/11/web-2-0-and-cloud-computing/</link>
		<comments>http://www.ganshani.com/2010/04/11/web-2-0-and-cloud-computing/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 18:55:21 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=567</guid>
		<description><![CDATA[
			
				
			
		
Recently conducted a free session on Web 2.0 and Cloud Computing at NIRMA University, Ahmedabad on 10th April, 2010
Workshop Duration: 2 hours
Date &#38; Time: 10th April, 2010 11:00 AM – 1 PM
Venue:
C Auditorium,
Nirma University
Sarkhej-Gandhinagar Highway,
Post : Chandlodia, Via : Gota,
Ahmedabad &#8211; 382 481.
Gujarat, India.
Workshop contents
Understanding evolution of Application Design (from DOS-based Applications to Web 2.0 applications)
Roadmap to Web 2.0: where, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F11%2Fweb-2-0-and-cloud-computing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F11%2Fweb-2-0-and-cloud-computing%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently conducted a <strong>free session</strong> on <strong>Web 2.0 and Cloud Computing at NIRMA University, Ahmedabad</strong> on <strong>10th April, 2010</strong></p>
<p><strong>Workshop Duration: </strong>2 hours</p>
<p><strong>Date &amp; Time: </strong>10th April, 2010 11:00 AM – 1 PM</p>
<p><strong>Venue:</strong><br />
C Auditorium,<br />
Nirma University<br />
Sarkhej-Gandhinagar Highway,<br />
Post : Chandlodia, Via : Gota,<br />
Ahmedabad &#8211; 382 481.<br />
Gujarat, India.</p>
<p><strong>Workshop contents</strong></p>
<p>Understanding evolution of Application Design (from DOS-based Applications to Web 2.0 applications)</p>
<p>Roadmap to Web 2.0: where, why, how?</p>
<p>Web 2.0 to Cloud Computing</p>
<p>Simplifying Cloud Computing – IaaS, SaaS, PaaS</p>
<p>Are you prepared?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/04/11/web-2-0-and-cloud-computing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Interview Questions &#8211; I</title>
		<link>http://www.ganshani.com/2010/02/12/silverlight-interview-questions-i/</link>
		<comments>http://www.ganshani.com/2010/02/12/silverlight-interview-questions-i/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 09:20:21 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Interview]]></category>
		<category><![CDATA[questions]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=548</guid>
		<description><![CDATA[
			
				
			
		
Hello folks,
Marching forward, I will post a series of Interview Questions on Silverlight.  This will cover questions at each level &#8211; easy, intermediate and advanced.  And I am sure, other sites &#38; users would post these on many other sites too  
So keep watching this space. Some questions below to start with
Level: Developer 

What [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/03/hosting-silverlight-as-desktop-applications-i/' rel='bookmark' title='Permanent Link: Hosting Silverlight as Desktop Applications &#8211; I'>Hosting Silverlight as Desktop Applications &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/09/17/silverlight-wpf-mvvm/' rel='bookmark' title='Permanent Link: Silverlight &#038; WPF: MVVM'>Silverlight &#038; WPF: MVVM</a></li>
<li><a href='http://www.ganshani.com/2009/07/14/silverlight-host-for-sharepoint/' rel='bookmark' title='Permanent Link: Silverlight Host for Sharepoint'>Silverlight Host for Sharepoint</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F02%2F12%2Fsilverlight-interview-questions-i%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F02%2F12%2Fsilverlight-interview-questions-i%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello folks,</p>
<p>Marching forward, I will post a series of Interview Questions on Silverlight.  This will cover questions at each level &#8211; easy, intermediate and advanced.  And I am sure, other sites &amp; users would post these on many other sites too <img src='http://www.ganshani.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So keep watching this space. Some questions below to start with</p>
<p><strong>Level: Developer</strong><strong> </strong></p>
<ul>
<li>What is the role of Silverlight Plugin in the Silverlight Application Life-Cycle?</li>
<li>What does the keyword &#8216;type&#8217; signify in the Silverlight Hosting page.
<pre class="brush: xml">
&lt;object data=&quot;data:application/x-silverlight-2,&quot;
type=&quot;application/x-silverlight-2&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
</pre>
</li>
<li>You have developed an application on Silverlight 2, will it execute on Silverlight 4 platform? Is vice-versa true?</li>
<li>Your organization has blocked download of any software from Internet and you want to deploy your Silverlight Application as Intranet Application.  The users do not have Silverlight plugin installed on their machine; however you have the installable.  How do you plan to deploy your application? Will you change the application code to fit this requirement or change the organization policy?</li>
<li>Your Silverlight application faces some technical errors while it is executed. Where will you write your code to get notification of these errors?</li>
<li>Can any Silverlight Application be viewed on Linux? Or a specific installation is required?</li>
<li>Assume your host page defines the background as White
<pre class="brush: xml">
&lt;param name=&quot;background&quot; value=&quot;white&quot; /&gt;
</pre>
<p>while your MainPage.xaml (that loads initially) defines background as &#8216;Gray&#8217;</p>
<pre class="brush: xml">
&lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;Gray&quot;&gt;
</pre>
<p>What will be the color of the background?</li>
<li>I have two actors to a Silverlight Application &#8211; Employee and Customer. The default page (default.html) should always open Customer view; whereas \view\employee.html should open Employee view.How would you implement this?</li>
<li>What is significance of initParams in
<pre class="brush: xml">
&lt;param name=&quot;initParams&quot; value=&quot;symbol=true&quot; /&gt;
</pre>
</li>
</ul>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/03/hosting-silverlight-as-desktop-applications-i/' rel='bookmark' title='Permanent Link: Hosting Silverlight as Desktop Applications &#8211; I'>Hosting Silverlight as Desktop Applications &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/09/17/silverlight-wpf-mvvm/' rel='bookmark' title='Permanent Link: Silverlight &#038; WPF: MVVM'>Silverlight &#038; WPF: MVVM</a></li>
<li><a href='http://www.ganshani.com/2009/07/14/silverlight-host-for-sharepoint/' rel='bookmark' title='Permanent Link: Silverlight Host for Sharepoint'>Silverlight Host for Sharepoint</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/02/12/silverlight-interview-questions-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Customizing Splash Screen in Silverlight</title>
		<link>http://www.ganshani.com/2010/02/10/customizing-splash-screen-in-silverlight/</link>
		<comments>http://www.ganshani.com/2010/02/10/customizing-splash-screen-in-silverlight/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 08:12:59 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Splash Screen]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=541</guid>
		<description><![CDATA[
			
				
			
		
Customizing Splash Screen (a screen that loads before the Silverlight application loads) requires some development effort in the host application (could be HTML/ASPX/any other application).
Creating SplashScreen.xaml
First, we create a XAML file &#8211; say SplashScreen.xaml file which displays two things &#8211; a progress bar and a textblock that displays &#8216;% completed&#8217;


&#60;Grid xmlns=&#34;&#60;a href=&#34;http://schemas.microsoft.com/client/2007&#34;&#62;http://schemas.microsoft.com/client/2007&#60;/a&#62;&#34;
        xmlns:x=&#34;&#60;a href=&#34;http://schemas.microsoft.com/winfx/2006/xaml&#34;&#62;http://schemas.microsoft.com/winfx/2006/xaml&#60;/a&#62;&#34;&#62;
   &#60;StackPanel VerticalAlignment=&#34;Center&#34;&#62;
      [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2010/02/12/silverlight-interview-questions-i/' rel='bookmark' title='Permanent Link: Silverlight Interview Questions &#8211; I'>Silverlight Interview Questions &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/09/17/hosting-silverlight-as-desktop-applications-ii/' rel='bookmark' title='Permanent Link: Hosting Silverlight as Desktop Applications &#8211; II'>Hosting Silverlight as Desktop Applications &#8211; II</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F02%2F10%2Fcustomizing-splash-screen-in-silverlight%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F02%2F10%2Fcustomizing-splash-screen-in-silverlight%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Customizing Splash Screen (a screen that loads before the Silverlight application loads) requires some development effort in the host application (could be HTML/ASPX/any other application).</p>
<h3>Creating SplashScreen.xaml</h3>
<p>First, we create a XAML file &#8211; say <strong>SplashScreen.xaml</strong> file which displays two things &#8211; a progress bar and a textblock that displays &#8216;% completed&#8217;</p>
<pre class="brush: xml">

&lt;Grid xmlns=&quot;&lt;a href=&quot;http://schemas.microsoft.com/client/2007&quot;&gt;http://schemas.microsoft.com/client/2007&lt;/a&gt;&quot;
        xmlns:x=&quot;&lt;a href=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;&quot;&gt;
   &lt;StackPanel VerticalAlignment=&quot;Center&quot;&gt;
      &lt;Grid&gt;
        &lt;Rectangle x:Name=&quot;&lt;strong&gt;baseBackground&lt;/strong&gt;&quot; Fill=&quot;Black&quot; Stroke=&quot;White&quot; StrokeThickness=&quot;1&quot; Stretch=&quot;Fill&quot; Height=&quot;30&quot; Margin=&quot;100,20&quot;&gt;&lt;/Rectangle&gt;
        &lt;Rectangle x:Name=&quot;&lt;strong&gt;movementBar&lt;/strong&gt;&quot; Fill=&quot;Gray&quot; Height=&quot;28&quot; Margin=&quot;101,20&quot;&gt;
          &lt;Rectangle.RenderTransform&gt;
            &lt;TransformGroup&gt;
              &lt;ScaleTransform x:Name=&quot;&lt;strong&gt;movementBarTransform&lt;/strong&gt;&quot; ScaleX=&quot;0&quot; ScaleY=&quot;1&quot;/&gt;
            &lt;/TransformGroup&gt;
          &lt;/Rectangle.RenderTransform&gt;
        &lt;/Rectangle&gt;
      &lt;/Grid&gt;
      &lt;TextBlock x:Name=&quot;&lt;strong&gt;progressText&lt;/strong&gt;&quot; HorizontalAlignment=&quot;Center&quot; Text=&quot;0% downloaded ...&quot;&gt;&lt;/TextBlock&gt;
    &lt;/StackPanel&gt;
&lt;/Grid&gt;
</pre>
<p>Here, we have a <strong>baseBackground</strong> (that forms background) that is Black in color and small bar that will move <strong>&#8216;movementBar</strong>&#8216; which is Gray in color.</p>
<p>As the page downloads the data, <strong>movementBarTransform</strong> needs to be changed, so that the movementBar appears as if it is increasing. And simultaneously, progressText should display the % downloaded.</p>
<h3>Modifying host file</h3>
<p>Now let&#8217;s modify the host file that loads the Silverlight Application.</p>
<pre class="brush: xml">

&lt;object data=&quot;data:application/x-silverlight,&quot; type=&quot;application/x-silverlight-2&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
   &lt;param name=&quot;source&quot; value=&quot;ClientBin/SplashScreen.xap&quot;/&gt;
   &lt;param name=&quot;onerror&quot; value=&quot;onSilverlightError&quot; /&gt;
   &lt;param name=&quot;background&quot; value=&quot;white&quot; /&gt;
   &lt;param name=&quot;splashscreensource&quot; value=&quot;SplashScreen.xaml&quot; /&gt;
   &lt;param name=&quot;onsourcedownloadprogresschanged&quot; value=&quot;onSourceDownloadProgressChanged&quot; /&gt;
   
   &lt;a href=&quot;&lt;a href=&quot;http://go.microsoft.com/fwlink/?LinkID=115261&quot;&gt;http://go.microsoft.com/fwlink/?LinkID=115261&lt;/a&gt;&quot; style=&quot;text-decoration: none;&quot;&gt;
        &lt;img src=&quot;&lt;a href=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot;&gt;http://go.microsoft.com/fwlink/?LinkId=108181&lt;/a&gt;&quot; alt=&quot;Get Microsoft Silverlight&quot; style=&quot;border-style: none&quot;/&gt;
   &lt;/a&gt;
  &lt;/object&gt;
</pre>
<p>The most important line that calls a JS function &#8216;onSourceDownloadProgressChanged&#8217; when some part (bytes) of the XAP is downloaded is:</p>
<pre class="brush: xml">

 &lt;param name=&quot;onsourcedownloadprogresschanged&quot; value=&quot;onSourceDownloadProgressChanged&quot; /&gt;
</pre>
<h3>Adding JS in hosting file</h3>
<pre class="brush: js">

function onSourceDownloadProgressChanged(sender, eventArgs)
        {
       
         sender.findName(&quot;progressText&quot;).Text = Math.round((eventArgs.progress * 100)) + &quot;% downloaded ...&quot;;        
         sender.findName(&quot;movementBarTransform&quot;).ScaleX = eventArgs.progress;        
        }
</pre>
<p>This code snippet calculates the percentage of XAP file downloaded and displays it in the textbox.  It also increases the ScaleX property of ScaleTransform of movementBar as per the progress.</p>
<h3>Testing the Splash Screen</h3>
<p>Now, add some heavy sized ZIP file in the Silverlight application so that your XAP file becomes atleast 5 MB and try to execute the application. </p>
<p>What you would see is a new custom Splash Screen</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2010/02/12/silverlight-interview-questions-i/' rel='bookmark' title='Permanent Link: Silverlight Interview Questions &#8211; I'>Silverlight Interview Questions &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/09/17/hosting-silverlight-as-desktop-applications-ii/' rel='bookmark' title='Permanent Link: Hosting Silverlight as Desktop Applications &#8211; II'>Hosting Silverlight as Desktop Applications &#8211; II</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/02/10/customizing-splash-screen-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClientAccessPolicy Sample</title>
		<link>http://www.ganshani.com/2010/01/21/clientaccesspolicy-sample/</link>
		<comments>http://www.ganshani.com/2010/01/21/clientaccesspolicy-sample/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 13:35:16 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[client access policy]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=531</guid>
		<description><![CDATA[
			
				
			
		
Recently I have delivered a 4-day training session on Silverlight 4 and many participants asked for a sample ClientAccessPolicy.xml file. So this is for those who want it  


&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;access-policy&#62;
  &#60;cross-domain-access&#62;
    &#60;policy&#62;
      &#60;allow-from http-request-headers=&#34;*&#34;&#62;
        &#60;domain uri=&#34;*&#34;/&#62;
      &#60;/allow-from&#62;
      &#60;grant-to&#62;
        &#60;resource path=&#34;/&#34; include-subpaths=&#34;true&#34;/&#62;
      &#60;/grant-to&#62;
    &#60;/policy&#62;
  &#60;/cross-domain-access&#62;
&#60;/access-policy&#62;

Just change the &#8220;*&#8221; to &#8220;*.xyz.com&#8221; to restrict permissions to [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/23/silverlight-training-kit/' rel='bookmark' title='Permanent Link: Silverlight Training Kit'>Silverlight Training Kit</a></li>
<li><a href='http://www.ganshani.com/2010/01/11/printing-in-silverlight-4/' rel='bookmark' title='Permanent Link: Printing in Silverlight 4'>Printing in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F21%2Fclientaccesspolicy-sample%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F21%2Fclientaccesspolicy-sample%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently I have delivered a 4-day training session on Silverlight 4 and many participants asked for a sample ClientAccessPolicy.xml file. So this is for those who want it <img src='http://www.ganshani.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: xml">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;access-policy&gt;
  &lt;cross-domain-access&gt;
    &lt;policy&gt;
      &lt;allow-from http-request-headers=&quot;*&quot;&gt;
        &lt;domain uri=&quot;*&quot;/&gt;
      &lt;/allow-from&gt;
      &lt;grant-to&gt;
        &lt;resource path=&quot;/&quot; include-subpaths=&quot;true&quot;/&gt;
      &lt;/grant-to&gt;
    &lt;/policy&gt;
  &lt;/cross-domain-access&gt;
&lt;/access-policy&gt;
</pre>
<p>Just change the &#8220;*&#8221; to &#8220;*.xyz.com&#8221; to restrict permissions to request originating from<span style="font-family: mceinline;"> </span><span style="font-family: mceinline;">xyz.com</span></p>
<pre class="brush: xml">

&lt;domain uri=&quot;*&quot;/&gt;
</pre>
<p>Happy creating of WCF services for Silverlight &amp; Flash..</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/23/silverlight-training-kit/' rel='bookmark' title='Permanent Link: Silverlight Training Kit'>Silverlight Training Kit</a></li>
<li><a href='http://www.ganshani.com/2010/01/11/printing-in-silverlight-4/' rel='bookmark' title='Permanent Link: Printing in Silverlight 4'>Printing in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/01/21/clientaccesspolicy-sample/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NotificationWindow in Silverlight (Out of Browser Apps)</title>
		<link>http://www.ganshani.com/2010/01/13/notificationwindow-in-silverlight-out-of-browser-apps/</link>
		<comments>http://www.ganshani.com/2010/01/13/notificationwindow-in-silverlight-out-of-browser-apps/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 05:58:06 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[NotificationWindow]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=525</guid>
		<description><![CDATA[
			
				
			
		
Silverlight 4 brings another feature to desk &#8211; NotificationWindow.  NotificationWindow is different from PopUp in following ways:

NotificationWindow opens as a Splash Screen, while PopUp does not.
NotificationWindow has an expiry time (set in MilliSeconds); while PopUp needs to be closed explicitly
NotfificationWindow can be implemented only for Out-Of-Browser applications; PopUp can be used for both Web and Out-Of-Browser [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2009/08/20/designing-a-popup-in-silverlight/' rel='bookmark' title='Permanent Link: Designing a PopUp in Silverlight'>Designing a PopUp in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2009/09/07/wpf-vs-wpf-xbap-vs-silverlight/' rel='bookmark' title='Permanent Link: WPF vs WPF XBAP vs Silverlight'>WPF vs WPF XBAP vs Silverlight</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F13%2Fnotificationwindow-in-silverlight-out-of-browser-apps%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F13%2Fnotificationwindow-in-silverlight-out-of-browser-apps%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Silverlight 4 brings another feature to desk &#8211; NotificationWindow.  NotificationWindow is different from PopUp in following ways:</p>
<ul>
<li>NotificationWindow opens as a Splash Screen, while PopUp does not.</li>
<li>NotificationWindow has an expiry time (set in MilliSeconds); while PopUp needs to be closed explicitly</li>
<li>NotfificationWindow can be implemented only for Out-Of-Browser applications; PopUp can be used for both Web and Out-Of-Browser applications</li>
</ul>
<p>With that, let&#8217;s see how to implement NotificationWindow for Silverlight Applications.</p>
<p><em><span style="font-family: mceinline;">Statement &#8211; Create NotificationWindow to denote a Upgrade Window</span></em></p>
<p>First, we will design a NotificationWindow &#8211; Create a New Silverlight UserControl and give it name: UpgradeWindow</p>
<pre class="brush: xml">

    &lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
        &lt;Border x:Name=&quot;Frame&quot; Width=&quot;300&quot; Height=&quot;100&quot; Background=&quot;LightYellow&quot;&gt;
            &lt;StackPanel Orientation=&quot;Vertical&quot;&gt;
                &lt;Border Width=&quot;290&quot; Height=&quot;24&quot; CornerRadius=&quot;4&quot; Margin=&quot;2,4,2,4&quot;&gt;
                    &lt;Border.Background&gt;
                        &lt;LinearGradientBrush StartPoint=&quot;0.5,0.0&quot; EndPoint=&quot;0.5,1.0&quot;&gt;
                            &lt;GradientStop Offset=&quot;0.2&quot; Color=&quot;#FF186220&quot; /&gt;
                            &lt;GradientStop Offset=&quot;0.9&quot; Color=&quot;#FFFFFFFF&quot; /&gt;
                            &lt;GradientStop Offset=&quot;0.1&quot; Color=&quot;#FF11A111&quot; /&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Border.Background&gt;
                    &lt;TextBlock Text=&quot;{Binding Title, Mode=OneWay}&quot; FontSize=&quot;12&quot; FontWeight=&quot;Bold&quot; Foreground=&quot;Black&quot; Margin=&quot;4&quot; /&gt;
                &lt;/Border&gt;
                &lt;TextBlock Width=&quot;240&quot; Text=&quot;{Binding Content, Mode=OneWay}&quot; FontSize=&quot;11&quot; Foreground=&quot;#FF202020&quot; TextWrapping=&quot;Wrap&quot; Margin=&quot;4&quot; /&gt;
            &lt;/StackPanel&gt;
        &lt;/Border&gt;
    &lt;/Grid&gt;
 
</pre>
<p>Next, we define a Model class for UpgradeWindow &#8211; UpgradeWindowModel.cs</p>
<pre class="brush: csharp">

public class UpgradeWindowModel : INotifyPropertyChanged
    {
        private string _title;
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                _title = value;
                OnPropertyChanged(value);
            }
        }

        private string _content;
        public string Content
        {
            get
            {
                return _content;
            }
            set
            {
                _content = value;
                OnPropertyChanged(value);
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
</pre>
<p>Further, we invoke this UpgradeWindow in our MainPage.cs</p>
<pre class="brush: csharp">

public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            LoadPopUpWindowInOutofBrowser();
        }

        private void LoadPopUpWindowInOutofBrowser()
        {
            NotificationWindow win = new NotificationWindow();
            UpgradeWindow un = new UpgradeWindow();
            un.DataContext = new UpgradeWindowModel { Title = &quot;Checking for upgrades&quot;,
                                                    Content =&quot;Downloading content...&quot; };
            win.Width = un.Width;
            win.Height = un.Height;
            win.Content = un;
            win.Show(10000);
        }
    }
</pre>
<p>And, the NotificationWindow will be displayed when the application is executed.</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/' rel='bookmark' title='Permanent Link: Right Click in Silverlight 4'>Right Click in Silverlight 4</a></li>
<li><a href='http://www.ganshani.com/2009/08/20/designing-a-popup-in-silverlight/' rel='bookmark' title='Permanent Link: Designing a PopUp in Silverlight'>Designing a PopUp in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2009/09/07/wpf-vs-wpf-xbap-vs-silverlight/' rel='bookmark' title='Permanent Link: WPF vs WPF XBAP vs Silverlight'>WPF vs WPF XBAP vs Silverlight</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/01/13/notificationwindow-in-silverlight-out-of-browser-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Winds, Woods, Water and Clouds!</title>
		<link>http://www.ganshani.com/2010/01/13/winds-woods-water-and-clouds/</link>
		<comments>http://www.ganshani.com/2010/01/13/winds-woods-water-and-clouds/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 04:32:06 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Off-track]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=523</guid>
		<description><![CDATA[
			
				
			
		
Winds, Woods, Water and Clouds! 
Two of my photographs of Thor Lake, Ahmedabad figure in thumbnails in – The Ahmedabad Mirror, The Times of India (TOI) - 
http://www.ahmedabadmirror.com/index.aspx?page=article&#38;sectid=9&#38;contentid=2010011220100112185925146b6e390ff 
The Thor Lake is one of the unexplored beautiful places in Ahmedabad. Not many are aware of a place where group outing can let you have a wonderful time. The [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F13%2Fwinds-woods-water-and-clouds%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F13%2Fwinds-woods-water-and-clouds%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Winds, Woods, Water and Clouds! </p>
<p>Two of my photographs of <em>Thor Lake, Ahmedabad</em> figure in thumbnails in – <u>The Ahmedabad Mirror, The Times of India (TOI)</u> - </p>
<p><a href="http://www.ahmedabadmirror.com/index.aspx?page=article&amp;sectid=9&amp;contentid=2010011220100112185925146b6e390ff">http://www.ahmedabadmirror.com/index.aspx?page=article&amp;sectid=9&amp;contentid=2010011220100112185925146b6e390ff</a> </p>
<p><em>The Thor Lake is one of the unexplored beautiful places in Ahmedabad. Not many are aware of a place where group outing can let you have a wonderful time. The photographs beautifully capture the windy atmosphere followed by dark clouds.</em> </p>
<p><em>regards,<br />
</em><em>a photography lover</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/01/13/winds-woods-water-and-clouds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Right Click in Silverlight 4</title>
		<link>http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/</link>
		<comments>http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 06:27:47 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[right click]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=511</guid>
		<description><![CDATA[
			
				
			
		
Let&#8217;s discuss yet another feature of Silverlight 4 &#8211; right click! This was most wanted feature and Microsoft has really blessed the Silverlight world by giving this feature!
Our solution will display a red colored box. User can right click within the area of the red box to customize it.  On right click, a pop up [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/08/20/designing-a-popup-in-silverlight/' rel='bookmark' title='Permanent Link: Designing a PopUp in Silverlight'>Designing a PopUp in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2010/01/13/notificationwindow-in-silverlight-out-of-browser-apps/' rel='bookmark' title='Permanent Link: NotificationWindow in Silverlight (Out of Browser Apps)'>NotificationWindow in Silverlight (Out of Browser Apps)</a></li>
<li><a href='http://www.ganshani.com/2009/08/21/visifire-charting-in-silverlight/' rel='bookmark' title='Permanent Link: Visifire Charting in Silverlight'>Visifire Charting in Silverlight</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F12%2Fright-click-in-silverlight-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F01%2F12%2Fright-click-in-silverlight-4%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Let&#8217;s discuss yet another feature of Silverlight 4 &#8211; right click! This was most wanted feature and Microsoft has really blessed the Silverlight world by giving this feature!</p>
<blockquote><p>Our solution will display a red colored box. User can right click within the area of the red box to customize it.  On right click, a pop up will be displayed which will allow the user to change the width &amp; height of the red box. This is the simplest example to demonstrate right click in Silverlight 4</p></blockquote>
<p>The design part (XAML):-</p>
<pre class="brush: xml">
&lt;UserControl x:Class=&quot;SilverlightRightClick.MainPage&quot;
xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
mc:Ignorable=&quot;d&quot;
d:DesignHeight=&quot;302&quot; d:DesignWidth=&quot;345&quot;&gt;

&lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
&lt;TextBlock Text=&quot;Right-click to customize&quot; FontWeight=&quot;Bold&quot; Margin=&quot;12,0,0,0&quot;/&gt;

&lt;Rectangle Height=&quot;254&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;12,24,0,0&quot; Name=&quot;frame&quot;
Stroke=&quot;Black&quot; StrokeThickness=&quot;4&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;320&quot; RadiusX=&quot;15&quot; RadiusY=&quot;15&quot; Fill=&quot;Red&quot;
MouseRightButtonDown=&quot;frame_MouseRightButtonDown&quot;
MouseRightButtonUp=&quot;frame_MouseRightButtonUp&quot; /&gt;

&lt;Popup x:Name=&quot;pop&quot;&gt;
&lt;Border Background=&quot;LightBlue&quot; Margin=&quot;10&quot; BorderBrush=&quot;Blue&quot; CornerRadius=&quot;5&quot; BorderThickness=&quot;3&quot;&gt;
&lt;Grid Width=&quot;235&quot; Height=&quot;138&quot;&gt;
&lt;TextBlock Text=&quot;Customize:&quot; FontWeight=&quot;Bold&quot; HorizontalAlignment=&quot;Center&quot; Margin=&quot;83,0,83,116&quot; /&gt;
&lt;TextBlock Height=&quot;23&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;19,30,0,0&quot; Name=&quot;textBlock1&quot; Text=&quot;Width:&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;60&quot; /&gt;
&lt;Slider Height=&quot;23&quot; Name=&quot;slWidth&quot; Margin=&quot;114,31,31,84&quot; Value=&quot;320&quot; Minimum=&quot;10&quot; Maximum=&quot;320&quot; ValueChanged=&quot;slWidth_ValueChanged&quot; /&gt;
&lt;TextBlock Height=&quot;23&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;19,72,0,0&quot; Name=&quot;Height&quot; Text=&quot;Height:&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;60&quot; /&gt;
&lt;Slider Height=&quot;23&quot; Margin=&quot;114,72,31,43&quot; Name=&quot;slheight&quot; Minimum=&quot;10&quot; Value=&quot;254&quot; Maximum=&quot;254&quot; ValueChanged=&quot;slheight_ValueChanged&quot; /&gt;
&lt;Button Content=&quot;Done&quot; Height=&quot;23&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;129,109,0,0&quot; Name=&quot;btnDone&quot; Click=&quot;btnDone_Click&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;75&quot; /&gt;
&lt;/Grid&gt;
&lt;/Border&gt;
&lt;/Popup&gt;
&lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
<p>The C# code for this XAML is:</p>
<pre class="brush: csharp">
namespace SilverlightRightClick
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}

private void frame_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
}

private void frame_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
pop.HorizontalOffset = e.GetPosition(null).X + 2;
pop.VerticalOffset = e.GetPosition(null).Y + 2;
pop.IsOpen = true;
}

private void slheight_ValueChanged(object sender, RoutedPropertyChangedEventArgs&lt;double&gt; e)
{
if (frame == null) return;
frame.Height = slheight.Value;
}

private void slWidth_ValueChanged(object sender, RoutedPropertyChangedEventArgs&lt;double&gt; e)
{
if (frame == null) return;
frame.Width = slWidth.Value;
}

private void btnDone_Click(object sender, RoutedEventArgs e)
{
pop.IsOpen = false;
}
}
}
</pre>
<p>Just execute this code and right click on the red colored box!</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/08/20/designing-a-popup-in-silverlight/' rel='bookmark' title='Permanent Link: Designing a PopUp in Silverlight'>Designing a PopUp in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2010/01/13/notificationwindow-in-silverlight-out-of-browser-apps/' rel='bookmark' title='Permanent Link: NotificationWindow in Silverlight (Out of Browser Apps)'>NotificationWindow in Silverlight (Out of Browser Apps)</a></li>
<li><a href='http://www.ganshani.com/2009/08/21/visifire-charting-in-silverlight/' rel='bookmark' title='Permanent Link: Visifire Charting in Silverlight'>Visifire Charting in Silverlight</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/01/12/right-click-in-silverlight-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
