<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/css" href="http://www.puneusergroup.org/Data/style/rss1.css" ?> <?xml-stylesheet type="text/xsl" href="http://www.puneusergroup.org/Data/xsl/rss1.xsl" ?>
<!--RSS generated by mojoPortal Blog Module V 1.0 on Tuesday, May 21, 2013-->
<rss version="2.0">
  <channel>
    <title />
    <link>http://www.puneusergroup.org/silverlight.aspx</link>
    <description />
    <copyright />
    <ttl>120</ttl>
    <managingEditor />
    <generator>mojoPortal Blog Module V 1.0</generator>
    <item>
      <title>Choose the way to Create a Silverlight Out-of-Browser Application</title>
      <link>http://www.puneusergroup.org/choose-the-way-to-create-a-silverlight-out-of-browser-application-2010-10-23.aspx</link>
      <pubDate>Sat, 23 Oct 2010 07:34:57 GMT</pubDate>
      <guid>http://www.puneusergroup.org/choose-the-way-to-create-a-silverlight-out-of-browser-application-2010-10-23.aspx</guid>
      <author>Kunal Chowdhury</author>
      <comments>http://www.puneusergroup.org/choose-the-way-to-create-a-silverlight-out-of-browser-application-2010-10-23.aspx</comments>
      <description><![CDATA[<p>In all of my earlier articles on Silverlight Out-of-Browser (OOB) applications, I demonstrated you creating the OOB application using Visual Studio. There are plenty of steps you have to follow there. Today I found another way to change the settings for it.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh4.ggpht.com/_MOj9mkIt81A/TMKOBx7iheI/AAAAAAAAGps/DjPy7MIcWeU/image%5B17%5D.png?imgmax=800" border="0" alt="image" width="616" height="83" /></p>
<p>In this post, I am going to discuss about both the processes and at the end tell me which one is best &amp; simple.</p>
<h2></h2>
<h2>Visual Studio way to Create OOB Application</h2>
<p>Open you Silverlight Solution in Visual Studio. Now in the Solution Explorer, right click on the Silverlight project and from the context menu click on the properties as shown in the below screenshot:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh5.ggpht.com/_MOj9mkIt81A/TMKOERtVgCI/AAAAAAAAGpw/DMnOGja8gyw/image%5B20%5D.png?imgmax=800" border="0" alt="image" width="530" height="305" /></p>
<p>This will open the below project properties Window inside the Visual Studio IDE. In the &ldquo;Silverlight&rdquo; tab, you will see a check box with the text &ldquo;Enable running application out of browser&rdquo;. Once checked, your application will now support running Out-of-Browser.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh3.ggpht.com/_MOj9mkIt81A/TMKOG9_d70I/AAAAAAAAGp0/zrJGXd10dYE/image%5B23%5D.png?imgmax=800" border="0" alt="image" width="616" height="388" /></p>
<p>Once you select the check box, it will enable the &ldquo;Out-of-Browser Settings&hellip;&rdquo; button. If you want to set the Elevated Trust mode for your Silverlight OOB application, click on that button.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh5.ggpht.com/_MOj9mkIt81A/TMKOK5Sz8eI/AAAAAAAAGp4/u5J0IR4sEe4/image%5B26%5D.png?imgmax=800" border="0" alt="image" width="616" height="364" /></p>
<p>This will open the &ldquo;Out-of-Browser Settings&rdquo; dialog on the screen. At the bottom of the settings page, you will see &ldquo;Require elevated trust when running outside the browser&rdquo; check box.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh6.ggpht.com/_MOj9mkIt81A/TMKON_J4piI/AAAAAAAAGp8/FKXcpq59ZB4/image%5B32%5D.png?imgmax=800" border="0" alt="image" width="347" height="442" /></p>
<p>Select the checkbox as shown below to mark your application trusted. Now click &ldquo;ok&rdquo; and save your project. Run your application now outside the browser window in fully trusted mode.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh5.ggpht.com/_MOj9mkIt81A/TMKOQepp_tI/AAAAAAAAGqA/iteQXDXg-yA/image%5B35%5D.png?imgmax=800" border="0" alt="image" width="347" height="442" /></p>
<p>Those were the steps to create a Silverlight OOB application in Visual Studio. Now, we will discuss the same using Expression Blend.</p>
<h2></h2>
<h2>Expression Blend way to Create OOB Application</h2>
<p>Open your Silverlight Solution in Expression Blend. Now go to &ldquo;Project&rdquo; menu &ndash;&gt; &ldquo;Silverlight Project Settings&rdquo; &ndash;&gt; &ldquo;Enable Application Outside Browser&rdquo;.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh3.ggpht.com/_MOj9mkIt81A/TMKOSSXfI_I/AAAAAAAAGqE/T7pkPF5naNs/image%5B2%5D.png?imgmax=800" border="0" alt="image" width="616" height="318" /></p>
<p>That&rsquo;s it to create a Silverlight OOB application. Blend will change the project settings for you. If you now go to the same menu, you will see that has been checked, means, your application supports running outside browser. If you don&rsquo;t want, uncheck the menu settings there.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh3.ggpht.com/_MOj9mkIt81A/TMKOUzU5bWI/AAAAAAAAGqI/Qr_8R-aWlbs/image%5B5%5D.png?imgmax=800" border="0" alt="image" width="616" height="316" /></p>
<p>The another menu item &ldquo;Preview Application Outside Browser&rdquo; by default gets selected once you enable OOB. This makes sure that, when you run the application from Blend, it directly starts in outside browser window.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh3.ggpht.com/_MOj9mkIt81A/TMKOYK50pII/AAAAAAAAGqM/rXGDdKwEazg/image%5B8%5D.png?imgmax=800" border="0" alt="image" width="616" height="317" /></p>
<p>If you want to set elevated trust for your application, just check the &ldquo;Application Requires Elevated Permission&rdquo; from the same menu path as shown below:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh6.ggpht.com/_MOj9mkIt81A/TMKOaq9lkyI/AAAAAAAAGqQ/MCzpvH9qlcc/image%5B11%5D.png?imgmax=800" border="0" alt="image" width="616" height="317" /></p>
<p>Wuhu! Your Silverlight application now supports running outside browser in fully trusted mode.</p>
<p>&nbsp;</p>
<h2>Summary</h2>
<p>In this post, I described you both the steps using Visual Studio &amp; Expression Blend. Now it is your choice to decide which is best for you. Hope, you liked this comparison and will help you. Please don&rsquo;t forget to share your thoughts, suggestions etc. I appreciate your feedbacks always.  Cheers&hellip; <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://lh5.ggpht.com/_MOj9mkIt81A/TMKOeEgm44I/AAAAAAAAGqU/suiPGpKus0U/wlEmoticon-smile%5B2%5D.png?imgmax=800" alt="Smile" /></p>
<p>&nbsp;</p>
<table style="width: 100%; height: 150px;" border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="width: 85px;" valign="top"><a href="http://www.kunal-chowdhury.com"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="line-height: 20px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Click Here to visit my Blog" src="http://lh4.ggpht.com/_MOj9mkIt81A/TEu6V0zJmcI/AAAAAAAAF3k/AGVbY9LyWvk/Kunal_Silverlight_Twibbon.png" border="0" alt="Click Here to visit my Blog" width="100" height="118" /></span></span></a></td>
<td style="width: 731px;" width="670" valign="top">
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">Kunal is a Microsoft MVP in Silverlight, currently working as a Software Engineer in Pune, India. He is a Silverlight enthusiastic and want to work in Silverlight, WPF &amp; Microsoft Surface. Apart from his daily office work, he spends a huge time on online communities. Writing articles, blogging, tweeting and answering to forums are some of his regular activities. He likes to share knowledge and learn newer things.&nbsp;</span></span></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;"><br /></span></span></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">Follow him in his blog: </span></span><a href="http://www.kunal-chowdhury.com/"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">http://www.kunal-chowdhury.com&nbsp;</span></span></a></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">He also Tweets. Follow him in Twitter - </span></span><a href="http://twitter.com/kunal2383" target="_blank"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">@kunal2383</span></span></a></p>
</td>
</tr>
</tbody>
</table><br /><br /><a href='http://www.puneusergroup.org'>Kunal Chowdhury</a>&nbsp;&nbsp;<a href='http://www.puneusergroup.org/choose-the-way-to-create-a-silverlight-out-of-browser-application-2010-10-23.aspx'>...</a>]]></description>
    </item>
    <item>
      <title>Simplest way to Create a Non-Movable Silverlight Child Window</title>
      <link>http://www.puneusergroup.org/simplest-way-to-create-a-non-movable-silverlight-child-window-2010-10-23.aspx</link>
      <pubDate>Fri, 22 Oct 2010 17:01:41 GMT</pubDate>
      <guid>http://www.puneusergroup.org/simplest-way-to-create-a-non-movable-silverlight-child-window-2010-10-23.aspx</guid>
      <author>Kunal Chowdhury</author>
      <comments>http://www.puneusergroup.org/simplest-way-to-create-a-non-movable-silverlight-child-window-2010-10-23.aspx</comments>
      <description><![CDATA[<p>Are you looking for a Silverlight Child Window, which can&rsquo;t move from it&rsquo;s actual position? Then this article will help you to understand &amp; create a non-movable child window in Silverlight.  Child Window is available inside the System.Windows.Controls.dll assembly. By default, it is movable. You can drag the Title Bar of the Window and position it anywhere in the screen. But, you may face some situation when you need to fix the position of the Window by restricting the user to drag it. So, how will you do this?  In this article, I will show you the simplest mechanism to make your child window not movable.</p>
<h2>Creating the Basic UI with ChildWindow</h2>
<p>Open your Expression Blend and create a Silverlight project. I am not demonstrating you on creating a project now, as I think you are familiar with that. If you are not familiar to that, read any of my earlier articles to know about it.  Once your Silverlight project is with you, go to the &ldquo;Assets&rdquo; tab as shown below and start searching for the &ldquo;ChildWindow&rdquo;. Add the Child Window to your Grid Layout. Now resize it properly and set a comfortable position of it as per your choice.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh6.ggpht.com/_MOj9mkIt81A/TL8nHiKE5bI/AAAAAAAAGpI/iG-O1_1LqHI/image%5B2%5D.png?imgmax=800" border="0" alt="image" width="313" height="442" /></p>
<p>If you run your application now, you will see the child window present in the UI. Click on the title bar position and try to drag it in any location. You will see, it is changing it&rsquo;s position.</p>
<h2>Create a Template for the ChildWindow</h2>
<p>Once you add the ChildWindow into the screen, we have to change the style by editing the template of the control. To do this, inside the blend IDE right click on the child window control. From the context menu, select &ldquo;Edit Template&rdquo; &ndash;&gt; &ldquo;Edit a Copy&hellip;&rdquo;.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh4.ggpht.com/_MOj9mkIt81A/TL8nMGLYx7I/AAAAAAAAGpM/LKHZ7Z-7EvU/image%5B11%5D.png?imgmax=800" border="0" alt="image" width="589" height="432" /></p>
<p>Now it will popup the &ldquo;Create Style Resource&rdquo; dialog to the screen. Give a proper name for your style e.g. &ldquo;NonMovableChildWindowStyle&rdquo;. Click &ldquo;ok&rdquo; to continue. If you want to set this style for all of your ChildWindow automatically, don&rsquo;t give any name here. Instead, select &ldquo;Apply to all&rdquo;. This will apply it globally.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh5.ggpht.com/_MOj9mkIt81A/TL8nPwSK3NI/AAAAAAAAGpQ/9__BFEyPYM8/image%5B14%5D.png?imgmax=800" border="0" alt="image" width="458" height="248" /></p>
<h2>Modifying the style</h2>
<p>Now you need to modify the generated style. Once you click on &ldquo;Edit Copy&hellip;&rdquo;, this will open the template editor in the same screen. Expand all the panels to reach to the border panel named &ldquo;Chrome&rdquo;. Here is the screen shot of the same:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh4.ggpht.com/_MOj9mkIt81A/TL8nYgXGMmI/AAAAAAAAGpU/faGnyuz-MhQ/image%5B17%5D.png?imgmax=800" border="0" alt="image" width="325" height="392" /></p>
<p>In the XAML, you will see the below code:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh4.ggpht.com/_MOj9mkIt81A/TL8ndR-fp9I/AAAAAAAAGpY/Hb-9vx8e0YI/image%5B23%5D.png?imgmax=800" border="0" alt="image" width="616" height="301" /></p>
<p>Search for the word &ldquo;Chrome&rdquo; if you are facing any difficulty as it generates a huge XAML code. Once you find out the code, just remove the x:Name=&rdquo;Chrome&rdquo; from the Border control.</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh5.ggpht.com/_MOj9mkIt81A/TL8nhPWxwPI/AAAAAAAAGpc/44ysVdqsZHQ/image%5B26%5D.png?imgmax=800" border="0" alt="image" width="616" height="302" /></p>
<p>Once you remove the x:Name=&rdquo;Chrome&rdquo; from the border control, the code will look similar to this:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh4.ggpht.com/_MOj9mkIt81A/TL8noRcPo4I/AAAAAAAAGpg/0P1Eocxeimc/image%5B29%5D.png?imgmax=800" border="0" alt="image" width="616" height="299" /></p>
<p>Now run your application once again and try to drag the ChildWindow. You will notice that, the child window is not movable now.  Alternative to the above find and delete method, you can also remove the name easily from the blend IDE. In the template explorer, click on the Border control named &ldquo;Chrome&rdquo; and you will notice it selected as below:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh6.ggpht.com/_MOj9mkIt81A/TL8ns4mfV9I/AAAAAAAAGpk/pgG-IaR94Kc/image%5B32%5D.png?imgmax=800" border="0" alt="image" width="326" height="376" /></p>
<p>Now delete the name from the control. That&rsquo;s it. It will remove the x:Name from the XAML and look like the below screenshot:</p>
<p><img style="background-image: none; display: block; float: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://lh3.ggpht.com/_MOj9mkIt81A/TL8nwDoPJnI/AAAAAAAAGpo/T6DlcjtTLvw/image%5B35%5D.png?imgmax=800" border="0" alt="image" width="325" height="394" /></p>
<p>In this case also, if you run your application, your child window will not get the event for moving around the screen.</p>
<p><strong>End Note</strong></p>
<p>As we removed the name &ldquo;Chrome&rdquo; from the XAML code, the ChildWindow implementation will not find the declaration of the &ldquo;Chrome&rdquo; and hence it will not do the dragging functionality.  This is just a simple hack I did for the ChildWindow today and wanted to share the same trick with you. To do it properly, you can create your own ChildWindow class extended from the base ChildWindow. Then create some properties to set whether it will be movable or not and based on the bool value set the dragging functionality to the Child Window.</p>
<table style="width: 100%; height: 150px;" border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="width: 85px;" valign="top"><a href="http://www.kunal-chowdhury.com"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="line-height: 20px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Click Here to visit my Blog" src="http://lh4.ggpht.com/_MOj9mkIt81A/TEu6V0zJmcI/AAAAAAAAF3k/AGVbY9LyWvk/Kunal_Silverlight_Twibbon.png" border="0" alt="Click Here to visit my Blog" width="100" height="118" /></span></span></a></td>
<td style="width: 731px;" width="670" valign="top">
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">Kunal is a Microsoft MVP in Silverlight, currently working as a Software Engineer in Pune, India. He is a Silverlight enthusiastic and want to work in Silverlight, WPF &amp; Microsoft Surface. Apart from his daily office work, he spends a huge time on online communities. Writing articles, blogging, tweeting and answering to forums are some of his regular activities. He likes to share knowledge and learn newer things.&nbsp;</span></span></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;"><br /></span></span></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">Follow him in his blog: </span></span><a href="http://www.kunal-chowdhury.com/"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">http://www.kunal-chowdhury.com&nbsp;</span></span></a></p>
<p><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">He also Tweets. Follow him in Twitter - </span></span><a href="http://twitter.com/kunal2383" target="_blank"><span style="font-family: verdana, helvetica, arial, sans-serif; color: #993333; font-size: small;"><span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">@kunal2383</span></span></a></p>
</td>
</tr>
</tbody>
</table><br /><br /><a href='http://www.puneusergroup.org'>Kunal Chowdhury</a>&nbsp;&nbsp;<a href='http://www.puneusergroup.org/simplest-way-to-create-a-non-movable-silverlight-child-window-2010-10-23.aspx'>...</a>]]></description>
    </item>
  </channel>
</rss>