<?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>Silverlight Tips of the Day</title>
	<atom:link href="http://www.michaelsnow.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.michaelsnow.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Aug 2010 15:53:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Silverlight Tip of the Day #33 &#8211; Dynamically working with Grid Columns and Rows</title>
		<link>http://www.michaelsnow.com/2010/08/03/silverlight-tip-of-the-day-33-dynamically-setting-a-grid-columnrow-of-a-control/</link>
		<comments>http://www.michaelsnow.com/2010/08/03/silverlight-tip-of-the-day-33-dynamically-setting-a-grid-columnrow-of-a-control/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 15:29:00 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[controls]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[row]]></category>

		<guid isPermaLink="false">http://www.michaelsnow.com/2010/08/03/silverlight-tip-of-the-day-33-dynamically-setting-a-grid-columnrow-of-a-control/</guid>
		<description><![CDATA[When declaring a Grids columns and rows in XAML you simply specify the rows you want and the columns you want under the Grid.RowDefinition and Grid.ColumnDefinition sections. 
For example:

&#60;Grid x:Name="LayoutRoot"&#62;
        &#60;Grid.RowDefinitions&#62;
            &#60;RowDefinition Height="100"&#62;&#60;/RowDefinition&#62;
     [...]]]></description>
			<content:encoded><![CDATA[<p>When declaring a Grids columns and rows in XAML you simply specify the rows you want and the columns you want under the Grid.RowDefinition and Grid.ColumnDefinition sections. </p>
<p>For example:</p>
<div class="csharpcode">
<pre class="alt">&lt;Grid x:Name=<span class="str">"LayoutRoot"</span>&gt;</pre>
<pre>        &lt;Grid.RowDefinitions&gt;</pre>
<pre class="alt">            &lt;RowDefinition Height=<span class="str">"100"</span>&gt;&lt;/RowDefinition&gt;</pre>
<pre>            &lt;RowDefinition Height=<span class="str">"Auto"</span>&gt;&lt;/RowDefinition&gt;</pre>
<pre class="alt">            &lt;RowDefinition Height=<span class="str">"*"</span>&gt;&lt;/RowDefinition&gt;</pre>
<pre>        &lt;/Grid.RowDefinitions&gt;</pre>
<pre class="alt">        &lt;Grid.ColumnDefinitions&gt;</pre>
<pre>            &lt;ColumnDefinition Width=<span class="str">"100"</span>&gt;&lt;/ColumnDefinition&gt;</pre>
<pre class="alt">            &lt;ColumnDefinition Width=<span class="str">"Auto"</span>&gt;&lt;/ColumnDefinition&gt;</pre>
<pre>            &lt;ColumnDefinition Width=<span class="str">"*"</span>&gt;&lt;/ColumnDefinition&gt;</pre>
<pre class="alt">        &lt;/Grid.ColumnDefinitions&gt;            </pre>
<pre>&lt;/Grid&gt;</pre>
<pre>&nbsp;</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>You can set a static width and height with any integer value. Alternatively you can use “*” which is used to indicate the row or column will take up any space not already used by the other columns or row. The other option is to set the row or column to “Auto”. This will cause the row or column to match the width or height of the controls that are in it.</p>
<p>To dynamically add rows and columns to a Grid control you will need to create a ColumnDefinition/RowDefinition object for each column/row you want, set the width/height and add it to the ColumnDefinitions/RowDefinitions collection of the Grid control.</p>
<p>For example:</p>
<div class="csharpcode">
<pre class="alt">LayoutRoot.ColumnDefinitions.Clear();</pre>
<pre>LayoutRoot.RowDefinitions.Clear();</pre>
<pre class="alt">&nbsp;</pre>
<pre><span class="kwrd">for</span> (column = 0; column &lt; columnCount; column++)</pre>
<pre class="alt">{</pre>
<pre>    ColumnDefinition cd = <span class="kwrd">new</span> ColumnDefinition();</pre>
<pre class="alt">    cd.Width = <span class="kwrd">new</span> GridLength(columnWidth);</pre>
<pre>    LayoutRoot.ColumnDefinitions.Add(cd);</pre>
<pre class="alt">&nbsp;</pre>
<pre>}</pre>
<pre class="alt">&nbsp;</pre>
<pre><span class="kwrd">for</span> (row = 0; row &lt; rowCount; row++)</pre>
<pre class="alt">{</pre>
<pre>    RowDefinition rd = <span class="kwrd">new</span> RowDefinition();</pre>
<pre class="alt">    rd.Height = <span class="kwrd">new</span> GridLength(rowHeight);</pre>
<pre>    LayoutRoot.RowDefinitions.Add(rd);</pre>
<pre class="alt">}</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>&nbsp;</p>
<p>When you specify what Grid Row and Column you want a control to belong to through XAML you do this by simply specifying the Grid.Row and Grid.Column properties in the declaration of the control. </p>
<p>For example, say you have a control called MapTile. To place it in Row 1 and Column 2 (zero based index) you would declare it in your XAML as such:</p>
<div class="csharpcode">
<pre class="alt">&lt;my:MapTile Grid.Row=<span class="str">"1"</span> Grid.Column=<span class="str">"2"</span> /&gt;</pre>
</div>
<p>&nbsp;</p>
<p>To do this dynamically however you have to call Grid.SetRow() and Grid.SetColumn().</p>
<p>For example:</p>
<div class="csharpcode">
<pre class="alt">MapTile mt = <span class="kwrd">new</span> MapTile();                    </pre>
<pre>Grid.SetColumn(mt, column);</pre>
<pre class="alt">Grid.SetRow(mt, row);</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>&nbsp;</p>
<p>Thanks,<br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/08/03/silverlight-tip-of-the-day-33-dynamically-setting-a-grid-columnrow-of-a-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silverlight Tip of the Day #32 &#8211; BiDi &#8211; Bi-Directional Text</title>
		<link>http://www.michaelsnow.com/2010/06/23/silverlight-tip-of-the-day-32-bidi-bi-directional-text/</link>
		<comments>http://www.michaelsnow.com/2010/06/23/silverlight-tip-of-the-day-32-bidi-bi-directional-text/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 19:57:33 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[bidi]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.michaelsnow.com/2010/06/23/silverlight-tip-of-the-day-32-bidi-bi-directional-text/</guid>
		<description><![CDATA[BiDi or Bi-directional text is text that flows right-to-left (RTL) and left-to-right (LTR). For example, while English flows left to right other languages such as Arabic, Hebrew and Persian scripts flow right to left. Chinese characters can also be written in either RTL or LTR directions.
Silverlight supports BiDi through a property called FlowDirection. This property [...]]]></description>
			<content:encoded><![CDATA[<p>BiDi or Bi-directional text is text that flows right-to-left (RTL) and left-to-right (LTR). For example, while English flows left to right other languages such as Arabic, Hebrew and Persian scripts flow right to left. Chinese characters can also be written in either RTL or LTR directions.</p>
<p>Silverlight supports BiDi through a property called FlowDirection. This property can be set to either RightToLeft or the default LeftToRight.</p>
<p>The following code below demonstrates this property in action:</p>
<div class="csharpcode">
<pre class="alt">&lt;TextBlock FlowDirection=<span class="str">&quot;RightToLeft&quot;</span> Text=<span class="str">&quot;نصائح Silverlight من اليوم&quot;</span>/&gt;</pre>
<pre>&lt;TextBlock FlowDirection=<span class="str">&quot;RightToLeft&quot;</span> Text=<span class="str">&quot;Silverlight 每日提示&quot;</span>/&gt;</pre>
<pre class="alt">&lt;TextBlock FlowDirection=<span class="str">&quot;LeftToRight&quot;</span> Text=<span class="str">&quot;Silverlight Tips of the Day&quot;</span>/&gt;</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>The first two TextBlocks flow RTL and the last one flows LTR.</p>
<p>Demo:<br />
  </p>
<p><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="300"><param name="source" value="http://www.michaelsnow.com/XAPS/Tip32_BIDI.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40723.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></p>
<p>Note that this property can also be applied to other controls such as RichTextBox, ListBox, TextBox, etc.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:222ccbce-6607-40bd-bc98-f3a2748c0220" class="wlWriterEditableSmartContent">
<p>Source: <a href="http://www.michaelsnow.com/wp-content/uploads/2010/06/Tip32_BIDI1.zip" target="_blank">Tip32_BIDI.zip</a></p>
</div>
<p>Thanks,<br />
  <br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/06/23/silverlight-tip-of-the-day-32-bidi-bi-directional-text/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silverlight Tip of the Day #31 &#8211; Pinning Full Screen Mode</title>
		<link>http://www.michaelsnow.com/2010/06/21/silverlight-tip-of-the-day-31-pinning-full-screen-mode/</link>
		<comments>http://www.michaelsnow.com/2010/06/21/silverlight-tip-of-the-day-31-pinning-full-screen-mode/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 17:31:31 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[full screen]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.michaelsnow.com/2010/06/21/silverlight-tip-of-the-day-31-pinning-full-screen-mode/</guid>
		<description><![CDATA[Full screen can be toggled on and off via a user command such as a button click by setting the following property to true or false: Application.Current.Host.Content.IsFullScreen
Normally Silverlight applications will only stay in full screen mode until a user hits the &#60;ESC&#62; key or until the application loses focus. For example, if the user has [...]]]></description>
			<content:encoded><![CDATA[<p>Full screen can be toggled on and off via a user command such as a button click by setting the following property to true or false: Application.Current.Host.Content.IsFullScreen</p>
<p>Normally Silverlight applications will only stay in full screen mode until a user hits the &lt;ESC&gt; key or until the application loses focus. For example, if the user has multiple monitors and they click on another application in another monitor this will cause the Silverlight application to return to windowed mode. If you want to prevent your Silverlight application from leaving full screen mode in this case you can do so by setting:</p>
<div class="csharpcode">
<pre class="alt">Application.Current.Host.Content.FullScreenOptions = </pre>
<pre>                 System.Windows.Interop.FullScreenOptions.StaysFullScreenWhenUnfocused;</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>Now, when a user clicks on another application in another monitor they will be prompted with the following dialog:</p>
<p><a href="http://www.michaelsnow.com/wp-content/uploads/2010/06/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.michaelsnow.com/wp-content/uploads/2010/06/image_thumb4.png" width="564" height="217" /></a> </p>
<p>If the user clicks ‘Remember my answer’ and the “Yes” button they will only need to be prompted this one time.</p>
<p>In the following demo below I have added a button that toggles full screen mode as well as an event that will update the status text to show whether we are in full screen mode or not:</p>
<div class="csharpcode">
<pre class="alt">App.Current.Host.Content.FullScreenChanged += ((sender, args) =&gt;</pre>
<pre>{</pre>
<pre class="alt">    <span class="kwrd">if</span> (App.Current.Host.Content.IsFullScreen)</pre>
<pre>    {</pre>
<pre class="alt">        ModeTB.Text = <span class="str">&quot;Mode=Full Screen&quot;</span>;</pre>
<pre>    }</pre>
<pre class="alt">    <span class="kwrd">else</span></pre>
<pre>    {</pre>
<pre class="alt">        ModeTB.Text = <span class="str">&quot;Mode=Windowed&quot;</span>;</pre>
<pre>    }</pre>
<pre class="alt">});</pre>
</div>
<p>&#160;</p>
<p>Demo:</p>
<p><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="300"><param name="source" value="http://www.michaelsnow.com/XAPS/Tip31_Pinning.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40723.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></p>
<p>Thanks,<br />
  <br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/06/21/silverlight-tip-of-the-day-31-pinning-full-screen-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Tip of the Day #30 &#8211; Sending Email from Silverlight</title>
		<link>http://www.michaelsnow.com/2010/06/10/silverlight-tip-of-the-day-30-sending-email-from-silverlight/</link>
		<comments>http://www.michaelsnow.com/2010/06/10/silverlight-tip-of-the-day-30-sending-email-from-silverlight/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 14:35:15 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[silverlight]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://www.michaelsnow.com/2010/06/10/silverlight-tip-of-the-day-30-sending-email-from-silverlight/</guid>
		<description><![CDATA[In this tip I will be showing you how to send an email via Silverlight. Obviously sending email directly from the Silverlight client is not possible.
However, as with most things, you can leverage a Silverlight-enabled WCF server to do the dirty work for you. In this steps below I will be showing you the code [...]]]></description>
			<content:encoded><![CDATA[<p>In this tip I will be showing you how to send an email via Silverlight. Obviously sending email directly from the Silverlight client is not possible.</p>
<p>However, as with most things, you can leverage a Silverlight-enabled WCF server to do the dirty work for you. In this steps below I will be showing you the code needed to send the email through the SmtpClient object as well as some minor configurations you need to do to your server to get it working.</p>
<p>Step #1. Create a new Silverlight application.</p>
<p>Step #2. In your web site, add a Silverlight-enabled WCF web service (calling it something like MyService.svc)</p>
<p>Step #3. Add the following method to your MyService.svc.cs file:</p>
<div class="csharpcode">
<pre class="alt">[OperationContract]</pre>
<pre><span class="kwrd">public</span> <span class="kwrd">bool</span> SendMail(<span class="kwrd">string</span> emailTo, <span class="kwrd">string</span> emailFrom, <span class="kwrd">string</span> msgSubject, <span class="kwrd">string</span> msgBody)</pre>
<pre class="alt">{</pre>
<pre>    <span class="kwrd">bool</span> success = <span class="kwrd">false</span>;</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">try</span></pre>
<pre class="alt">    {</pre>
<pre>        MailMessage msg = <span class="kwrd">new</span> MailMessage();</pre>
<pre class="alt">&#160;</pre>
<pre>        msg.From = <span class="kwrd">new</span> MailAddress(emailFrom);</pre>
<pre class="alt">        msg.To.Add(<span class="kwrd">new</span> MailAddress(emailTo));</pre>
<pre>        msg.Subject = msgSubject;</pre>
<pre class="alt">        msg.Body = msgBody;</pre>
<pre>        msg.IsBodyHtml = <span class="kwrd">true</span>;</pre>
<pre class="alt">&#160;</pre>
<pre>        SmtpClient smtp = <span class="kwrd">new</span> SmtpClient();</pre>
<pre class="alt">        smtp.Host = <span class="str">&quot;111.111.111.111&quot;</span>; // Replace with your servers IP address</pre>
<pre>        smtp.Port = 25;</pre>
<pre class="alt">        smtp.EnableSsl = <span class="kwrd">false</span>;</pre>
<pre>        smtp.Send(msg);</pre>
<pre class="alt">        success = <span class="kwrd">true</span>;</pre>
<pre>    }</pre>
<pre class="alt">    <span class="kwrd">catch</span></pre>
<pre>    {</pre>
<pre class="alt">        success = <span class="kwrd">false</span>;</pre>
<pre>    }</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">return</span> success;</pre>
<pre class="alt">}</pre>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>Step #4: Build the web site</p>
<p>Step #5: In your Silverlight application, right click on Service Reference and choose Add Service Reference…</p>
<p>Step #6: Click the Discover button, choose your service under “Services” and click the OK button.</p>
<p>Step #7. At this point, in your Silverlight code, you can create a ServiceReference client and call the method directly like this:</p>
<div class="csharpcode">
<pre class="alt">ServiceReferenceTest.MyServiceClient client = <span class="kwrd">new</span> ServiceReferenceTest.MyServiceClient ();</pre>
<pre>&#160;</pre>
<pre class="alt">client.SendMailAsynce(emailTo, emailFrom, msgSubject, msgBody);</pre>
</div>
<p>&#160;</p>
<p>Note that if you were to execute this code without first installing the SMTP Sever via IIS you would get a “Send Failed” exception.</p>
<p>Step #8: In your server open up the Server Manager (ServerManager.msc) and choose Add Features.</p>
<p>Step #9: Select SMTP Server and click Next until the install is complete.</p>
<p>At this point if you were to run the code you would get the following exception:</p>
<p><i>Mailbox unavailable. The server response was: 5.7.1 Unable to relay for…</i></p>
<p>Step #10: Open up IIS <b>6 </b>Manager (not IIS Manager)</p>
<p>Step #11: Right click on SMTP Virtual Server and choose Properties.</p>
<p>Step #12: Under the Access tab, choose Authentication and verify Anonymous access is checked.</p>
<p>Step #13: Under the Access tab, click the “Relay” button and add the IP of your server&#160; making certain the “Only the list below” button is checked.</p>
<p>At this point you should be good to go!</p>
<p>Thanks,<br />
  <br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/06/10/silverlight-tip-of-the-day-30-sending-email-from-silverlight/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Silverlight Tip of the Day #29 &#8211; Configuring Service Reference to Back to LocalHost</title>
		<link>http://www.michaelsnow.com/2010/06/09/silverlight-tip-of-the-day-29-configuring-service-reference-to-back-to-localhost/</link>
		<comments>http://www.michaelsnow.com/2010/06/09/silverlight-tip-of-the-day-29-configuring-service-reference-to-back-to-localhost/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 03:53:15 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[silverlight]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://www.michaelsnow.com/2010/06/09/silverlight-tip-of-the-day-29-configuring-service-reference-to-back-to-localhost/</guid>
		<description><![CDATA[If your application leverages a Silverlight-enabled WCF service you may at times want to toggle the address to be pointing from the WCF service published and running on your server back to localhost in case you want to make modifications that you want to run and debug locally. 
However, when pointing it back to localhost [...]]]></description>
			<content:encoded><![CDATA[<p>If your application leverages a Silverlight-enabled WCF service you may at times want to toggle the address to be pointing from the WCF service published and running on your server back to localhost in case you want to make modifications that you want to run and debug locally. </p>
<p>However, when pointing it back to localhost you might be stumped as to what port needs to be used. One easy way to determine this is to right click on your svc file in your web site, choose “Browse With”, select a browser and click the “Browse” button.</p>
<p>In your browser, copy the address from the address bar. This is the localhost address including the port you will want to configure your Silverlight service reference to point to. It will look like this:</p>
<p><a title="http://localhost:21047/MyService.svc" href="http://localhost:21047/MyService.svc">http://localhost:21047/MyService.svc</a>&#160;</p>
<p>Thanks,   <br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/06/09/silverlight-tip-of-the-day-29-configuring-service-reference-to-back-to-localhost/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
