<?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>Designer Silverlight &#187; Silverlight</title>
	<atom:link href="http://www.designersilverlight.com/category/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designersilverlight.com</link>
	<description>Matthias Shapiro's Silverlight &#38; WPF Blog - Because Developers Get All The Good Blogs</description>
	<lastBuildDate>Sun, 05 Sep 2010 21:43:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP, MySQL, and Silverlight: The Complete Tutorial (Part 3)</title>
		<link>http://www.designersilverlight.com/2010/05/24/php-mysql-and-silverlight-the-complete-tutorial-part-3/</link>
		<comments>http://www.designersilverlight.com/2010/05/24/php-mysql-and-silverlight-the-complete-tutorial-part-3/#comments</comments>
		<pubDate>Mon, 24 May 2010 19:30:58 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Binding]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[eventtrigger]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=970</guid>
		<description><![CDATA[This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”. Here is an example of the finished product (I reserve the right to clean up the data on a regular basis): [...]]]></description>
			<content:encoded><![CDATA[<p>This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”. Here is an example of the finished product (I reserve the right to clean up the data on a regular basis):</p>
<div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="500px" height="300px"><param name="source" value="http://designersilverlight.com/Silverlight/ToDo_List_Tutorial.xap"/><param name="onerror" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40818.0" /><param name="autoUpgrade" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&#038;v=3.0.40818.0" style="text-decoration: none;"><br />
				<img src="http://go.microsoft.com/fwlink/?LinkID=161376" alt="Get Microsoft Silverlight" style="border-style: none"/><br />
			</a><br />
		</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
<p><a href="http://www.designersilverlight.com/2010/05/22/php-mysql-and-silverlight-the-complete-tutorial-part-1/">Part 1: MySQL</a></p>
<p><a href="http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-2/">Part 2: PHP</a></p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/AllFiles_PHP_and_Silverlight.zip">Download all files (PHP &#038; Silverlight)</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/PHP_Tutorial_Files.zip">Download PHP files only</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/ToDo_List_Tutorial.zip">Download Silverlight project only</a></p>
<p>In Part 1, we created the MySQL tables necessary to store data for a simple to-do list. In Part 2, we wrote a PHP service to deliver the items in our to-do list in JSON format. In Part 3, we’ll create a Silverlight application that can utilize this web service to retrieve, display, and edit the to-do list.</p>
<h2>Part 3: Connecting Silverlight To Our PHP Web Service</h2>
<p>First, let’s start a new Silverlight project. (You can download the full project here.) In the interest of time, I’m not going to go into the details of the “ideal” implementation for this. I’m just going to show the parts necessary to retrieve, display and interact with the to-do data.</p>
<p>Before we start with the UI, let’s build a model so that we can appropriately bind our data. Add a new folder to the Silverlight project and name it “Models”. Add a new class to it and name the class “ToDoItem.cs”. In this instance, we’re just going to make the model look just like our MySQL table.</p>
<p><strong>ToDoItem.cs</strong></p>
<p><span style="color: #0000ff; font-size: small;"> </span></p>
<p><span style="color: #0000ff; font-size: small;"><span style="font-family: Consolas;">p<span style="font-size: small;">ublic </span></span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #0000ff;">class</span><span style="color: #000000;"> </span><span style="color: #2b91af;">ToDoItem</span></span></span><br />
<span style="font-family: Consolas; font-size: small;">{<br />
</span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">bool</span><span style="color: #000000;"> isDone { </span><span style="color: #0000ff;">get</span><span style="color: #000000;">; </span><span style="color: #0000ff;">set</span></span></span><span style="color: #000000;"><span style="font-family: Consolas; font-size: small;">; }</span></span><br />
<span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #0000ff;"> public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">string</span><span style="color: #000000;"> toDoDescription {</span><span style="color: #0000ff;">get</span><span style="color: #000000;">; </span><span style="color: #0000ff;">set</span></span></span><span style="color: #000000;"><span style="font-family: Consolas; font-size: small;">;}</span></span><br />
<span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #0000ff;"> public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> toDoID {</span><span style="color: #0000ff;">get</span><span style="color: #000000;">; </span><span style="color: #0000ff;">set</span></span></span><span style="color: #000000;"><span style="font-family: Consolas; font-size: small;">;}</span></span><br />
<span style="font-family: Consolas; color: #0000ff; font-size: small;"><br />
public</span><span style="color: #000000;"><span style="font-family: Consolas; font-size: small;"> ToDoItem()</span></span> <span style="font-family: Consolas; font-size: small;">{ </span><span style="font-family: Consolas; font-size: small;">}<br />
</span><span style="font-family: Consolas; font-size: small;">}</span></span></p>
<p><span style="color: #0000ff; font-size: small;"><span style="font-family: Consolas; font-size: small;"> </span></span></p>
<p><span style="color: #0000ff; font-size: small;"> </span></p>
<p>Now, we’ll add to our MainPage.xaml a ListBox named “ToDoList” that will hold the to-do items and a Grid to house the UI to add a new to-do. We’ll work on gathering and displaying our items first.</p>
<p>Right-click on the ListBox and go to “<strong>Edit Additional Templates –&gt; Edit Generated Items (ItemTemplate) –&gt; Create Empty…</strong>”<br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0012.png"><img style="display: inline; border-width: 0px;" title="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image001_thumb2.png" border="0" alt="clip_image001" width="634" height="94" /></a><br />
You’ll love this part… Just add a checkbox to it. That’s all we’ll need, so that’s all we’ll add. Then, go into the XAML and make the checkbox look like this:</p>
<p><span style="color: #0000ff; font-size: small;"> </span></p>
<p><span style="color: #0000ff; font-size: small;"><span style="font-family: Consolas; font-size: small;">&lt;</span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #a31515;">CheckBox</span><span style="color: #ff0000;"> Content</span><span style="color: #0000ff;">=&#8221;{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> toDoDescription</span><span style="color: #0000ff;">}&#8221;<br />
</span></span></span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #ff0000;"> IsChecked</span><span style="color: #0000ff;">=&#8221;{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> isDone</span><span style="color: #0000ff;">}&#8221;</span></span></span><span style="color: #000000;"> </span><br />
<span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #ff0000;"> Tag</span><span style="color: #0000ff;">=&#8221;{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> toDoID</span><span style="color: #0000ff;">}&#8221; /&gt;</span></span></span></span></p>
<p><span style="color: #0000ff; font-size: small;"> </span></p>
<p><span style="font-family: Consolas; color: #0000ff; font-size: small;"> </span></p>
<p>This binding is all we’ll need once we gather our to-dos from the web service and attach it to the ListBox. Let’s go ahead and get that data into this ListBox.</p>
<p>Open MainPage.xaml.cs and, at the top of the class, add:</p>
<p><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #2b91af;">WebClient</span><span style="color: #000000;"> wc = </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> </span><span style="color: #2b91af;">WebClient</span></span></span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #000000;">();<br />
</span><span style="color: #2b91af;">ObservableCollection</span><span style="color: #000000;">&lt;</span><span style="color: #2b91af;">ToDoItem</span><span style="color: #000000;">&gt; myToDoList = </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> </span><span style="color: #2b91af;">ObservableCollection</span><span style="color: #000000;">&lt;</span><span style="color: #2b91af;">ToDoItem</span></span></span><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #000000;">&gt;();<br />
</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> baseURI = </span><span style="color: #a31515;">&#8220;http://&lt;Web_address_holding_your_php_files&gt;&#8221;</span><span style="color: #000000;">;</span></span></span></p>
<p>You may have to add “using System.Net;” and “using System.Collections.ObjectModel;” to the top of the file. While we’re adding references, right-click on the “References” folder and find the “System.Json” component and add it to the project. Then add “using System.Json;” to the references section in the top.  It’ll come in handy in a minute.</p>
<p>In the MainPage() method under InitializeComponent(), type “wc.DownloadStringCompleted += “ and hit TAB twice. This will add an event handler for when the WebClient has finished connecting to the web service we wrote.</p>
<p>The resulting event handler (which should be named “wc_DownloadStringCompleted”), is the code that our application will go to whenever it makes a call to our web service and gets a result. In it, we will do the following things:</p>
<ol>
<li>Check to make sure we got a result without error</li>
<li>Check to see what kind of result we got (did we get all to-do items? or add a new to-do item?)</li>
<li>Walk through the result, extracting the data we need</li>
<li>Apply that data to the UI</li>
</ol>
<p>Let’s add the code to do that for getting all the items. Make your event handler look like this:</p>
<div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7934bf62-c08c-435e-980b-d18700e35c2b" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px;">wc_DownloadStringCompleted</div>
<div style="background: #ddd; max-height: 400px; overflow: auto;">
<ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;">
<li><span style="color: #0000ff;">void</span> wc_DownloadStringCompleted(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">DownloadStringCompletedEventArgs</span> e)</li>
<li style="background: #f3f3f3;"> {</li>
<li> <span style="color: #0000ff;">if</span> (e.Error == <span style="color: #0000ff;">null</span> &amp;&amp; e.Result!= <span style="color: #a31515;">&#8220;&#8221;</span>)</li>
<li style="background: #f3f3f3;"> {</li>
<li> <span style="color: #2b91af;">JsonValue</span> completeResult = <span style="color: #2b91af;">JsonPrimitive</span>.Parse(e.Result);</li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">string</span> resultType = completeResult[<span style="color: #a31515;">"returnType"</span>].ToString().Replace(<span style="color: #a31515;">&#8216;&#8221;&#8216;</span>, <span style="color: #a31515;">&#8216; &#8216;</span>).Trim();</li>
<li> <span style="color: #0000ff;">if</span> (resultType == <span style="color: #a31515;">&#8220;todoItems&#8221;</span>)</li>
<li style="background: #f3f3f3;"> {</li>
<li> myToDoList.Clear();</li>
<li style="background: #f3f3f3;"></li>
<li> <span style="color: #2b91af;">JsonArray</span> toDoItemsJson = (<span style="color: #2b91af;">JsonArray</span>)completeResult[<span style="color: #a31515;">"results"</span>];</li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">foreach</span> (<span style="color: #2b91af;">JsonValue</span> todoItemJson <span style="color: #0000ff;">in</span> toDoItemsJson)</li>
<li> {</li>
<li style="background: #f3f3f3;"> <span style="color: #2b91af;">ToDoItem</span> thisTodo = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">ToDoItem</span>();</li>
<li></li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">if</span> (todoItemJson[<span style="color: #a31515;">"ToDoIndex"</span>] != <span style="color: #0000ff;">null</span>)</li>
<li> thisTodo.toDoID = <span style="color: #2b91af;">Convert</span>.ToInt32(todoItemJson[<span style="color: #a31515;">"ToDoIndex"</span>].ToString().Replace(<span style="color: #a31515;">&#8216;&#8221;&#8216;</span>, <span style="color: #a31515;">&#8216; &#8216;</span>).Trim());</li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">if</span> (todoItemJson[<span style="color: #a31515;">"TodoText"</span>] != <span style="color: #0000ff;">null</span>)</li>
<li> thisTodo.toDoDescription = todoItemJson[<span style="color: #a31515;">"TodoText"</span>].ToString().Replace(<span style="color: #a31515;">&#8216;&#8221;&#8216;</span>, <span style="color: #a31515;">&#8216; &#8216;</span>).Trim();</li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">if</span> (todoItemJson[<span style="color: #a31515;">"IsDone"</span>] != <span style="color: #0000ff;">null</span>)</li>
<li> {</li>
<li style="background: #f3f3f3;"> <span style="color: #0000ff;">int</span> isDoneInt =  <span style="color: #2b91af;">Convert</span>.ToInt32(todoItemJson[<span style="color: #a31515;">"IsDone"</span>].ToString().Replace(<span style="color: #a31515;">&#8216;&#8221;&#8216;</span>, <span style="color: #a31515;">&#8216; &#8216;</span>).Trim());</li>
<li> <span style="color: #0000ff;">if</span>(isDoneInt == 0){</li>
<li style="background: #f3f3f3;"> thisTodo.isDone = <span style="color: #0000ff;">false</span>;</li>
<li> } <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> (isDoneInt == 1){</li>
<li style="background: #f3f3f3;"> thisTodo.isDone = <span style="color: #0000ff;">true</span>;</li>
<li> }</li>
<li style="background: #f3f3f3;"> }</li>
<li> myToDoList.Add(thisTodo);</li>
<li style="background: #f3f3f3;"> }</li>
<li> ToDoList.ItemsSource = myToDoList;</li>
<li style="background: #f3f3f3;"> }</li>
<li> }</li>
<li style="background: #f3f3f3;"> }</li>
</ol>
</div>
</div>
</div>
<p>With this in place, all we need to do is make a call to the get_todo_items.php, which we can do by adding this code just below the wc.DownloadStringCompleted line in the MainPage() method.</p>
<p><span style="font-size: small;"><span style="font-family: Consolas;"><span style="color: #000000;">wc.DownloadStringAsync(</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> </span><span style="color: #2b91af;">Uri</span><span style="color: #000000;">(baseURI + </span><span style="color: #a31515;">&#8220;get_todo_items.php&#8221;</span><span style="color: #000000;">));</span></span></span></p>
<p>When we run the project, we should get all objects from our database and the results should show up just the way we want in our Silverlight application. We will follow the exact same model to add new to-do items and update the to-do items we already have.</p>
<p>I’m in the process of separating out the final part of this tutorial (adding and updating the items) into a supplemental post so that I can wrap this post up. I encourage anyone walking through this to try to complete those parts by yourself and refer to the last bit only if you get stuck.</p>
<p>Finally, a little bit of warning. I structured this project to get it working in as straightforward a manner as possible. It is not in any way the ideal architectural example for a data-driven Silverlight application. It’s just a good way to get started using Silverlight in an environment that isn’t 100% Microsoft technologies.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2010/05/24/php-mysql-and-silverlight-the-complete-tutorial-part-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP, MySQL, and Silverlight: The Complete Tutorial (Part 2)</title>
		<link>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-2/</link>
		<comments>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-2/#comments</comments>
		<pubDate>Mon, 24 May 2010 00:07:35 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=964</guid>
		<description><![CDATA[This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”. Here is an example of the finished product (I reserve the right to clean up the data on a regular basis): [...]]]></description>
			<content:encoded><![CDATA[<p>This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”.</p>
<p>Here is an example of the finished product (I reserve the right to clean up the data on a regular basis):</p>
<div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="500px" height="300px"><param name="source" value="http://designersilverlight.com/Silverlight/ToDo_List_Tutorial.xap"/><param name="onerror" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40818.0" /><param name="autoUpgrade" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&#038;v=3.0.40818.0" style="text-decoration: none;"><br />
				<img src="http://go.microsoft.com/fwlink/?LinkID=161376" alt="Get Microsoft Silverlight" style="border-style: none"/><br />
			</a><br />
		</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
<p><a href="http://www.designersilverlight.com/2010/05/22/php-mysql-and-silverlight-the-complete-tutorial-part-1/">Part 1: MySQL</a></p>
<p><a href="http://www.designersilverlight.com/2010/05/24/php-mysql-and-silverlight-the-complete-tutorial-part-3/">Part 3: Silverlight</a></p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/AllFiles_PHP_and_Silverlight.zip">Download all files (PHP &#038; Silverlight)</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/PHP_Tutorial_Files.zip">Download PHP files only</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/ToDo_List_Tutorial.zip">Download Silverlight project only</a></p>
<p>In Part 1, we created the MySQL tables necessary to store data for a simple to-do list. In Part 2, we’ll write some PHP code that will give us the ability to grab the data out of the database and send it, in JSON format, to our Silverlight application.</p>
<h2>Part 2: Writing the PHP Web Service</h2>
<p>We’re going to create 4 PHP files (<a href="../wp-content/uploads/2010/05/PHP_Tutorial_Files.zip">download  php files</a>):</p>
<ul>
<li>mysql_vars.php – holds all the information for connecting to the MySQL database</li>
<li>get_todo_items.php – for getting all the to do items</li>
<li>add_todo_item.php – adds a to do item</li>
<li>change_status.php – changes a to-do item from “not done” to “done” or vice versa</li>
</ul>
<p>Since all these projects will be using the information in mysql_vars.php, we’ll write that first.</p>
<p><strong>mysql_vars.php</strong></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
$dbUsername = &#8220;<span style="color: #cc0000;">[my_database_username]</span>&#8220;;<br />
$dbPassword = &#8220;<span style="color: #cc0000;">[my_database_password]</span>&#8220;;<br />
$db = &#8220;<span style="color: #cc0000;">[my_database_name]</span>&#8220;;<br />
$server = &#8220;<span style="color: #cc0000;">[my_database_server]</span>&#8220;;</p>
<p><span style="color: #ff9900;"> //To Do Table and Column Names</span><br />
$mysql_todoTable  = &#8220;<span style="color: #cc0000;">to_do_data</span>&#8220;;<br />
$mysql_todoIndexCol = &#8220;<span style="color: #cc0000;">index_key</span>&#8220;;<br />
$mysql_isDoneCol = &#8220;<span style="color: #cc0000;">is_done</span>&#8220;;<br />
$mysql_todoTextCol = &#8220;<span style="color: #cc0000;">to_do_text</span>&#8220;;</p>
<p>$connection = <span style="color: #0000ff;">mysql_connect</span>($server, $dbUsername, $dbPassword);</p>
<p><span style="color: #0000ff;"> function</span> formatInput($rawURLData)<br />
{<br />
$returnString = <span style="color: #0000ff;">urldecode</span>($rawURLData);<br />
$returnString = <span style="color: #0000ff;">mysql_real_escape_string</span>($returnString);<br />
<span style="color: #006600;">return</span> $returnString;<br />
}<br />
<span style="color: #ff0000;">?&gt;</span></p>
<p>We’ve added the to-do table and column names so that, if we decide to change anything later, we can just go to this file and update the table or column once.</p>
<p>Just for good measure, we’ve added a function we’ll want to use across our php files. The function “formatInput” will be used to make sure all our data is decoded from the URL that calls our web service (the urldecode method) and then try to block any SQL injections (the mysql_real_escape_string method).</p>
<p>Now, let’s write the basic “Get the data” file. What we’re going to do is write it so that the we can choose to get:</p>
<ul>
<li>all the to-do items</li>
<li>all the to-do items that are “done”</li>
<li>all the to-do items that are “not done”</li>
</ul>
<p>This range of functionality isn’t even close to ideal. In a perfect world, we would want a wider range of options in gathering items (for example, items that contain a certain word or one item in particular or limit the number of items we call by a date range). However, for our very simple purposes, this will do.</p>
<p>The way our web service will work is that we have a URL that we’ll call from Silverlight when we want to get some data. When we calls this web service, we may want only the &#8220;not done&#8221; items or only the &#8220;done&#8221; items. We&#8217;ll handle that option by adding &#8220;?itemStatus=done&#8221; or &#8220;?itemStatus=notDone&#8221; to the end of the URL.</p>
<p>Example: if our base URL is</p>
<p><a href="http://www.mywebsite.com/">http://www.mywebsite.com/</a></p>
<p>the call to</p>
<p><a href="http://www.mywebsite.com/get_todo_items.php">http://www.mywebsite.com/get_todo_items.php</a></p>
<p>will get all items, regardless of their completed status while</p>
<p><a href="http://www.mywebsite.com/get_todo_items.php?itemStatus=done">http://www.mywebsite.com/get_todo_items.php?itemStatus=done</a></p>
<p>will get all the to do items that are complete. So we need to make sure that our web service responds appropriately to both calls.</p>
<p>There are comments in the code, but I&#8217;ll just explain the basic concept in picture form:</p>
<p>We take in a URL, extract the variables from it, create the MySQL query based on the variables, execute the MySQL query, extract the results, and then send back the php object encoded as a Json object. Each one of our files will follow this same pattern.</p>
<p><strong>get_todo_items.php</strong></p>
<p><span style="color: #ff0000;">&lt;?</span><br />
<span style="color: #008000;"> include</span> <span style="color: #cc0000;">&#8216;mysql_vars.php&#8217;</span>;</p>
<p><span style="color: #ff9900;"> //    set up the &#8220;itemStatus&#8221; URL option and build a query addition<br />
//        to account for the itemStatus variable<br />
</span>$itemStatus = <span style="color: #0066ff;">$_GET</span>[<span style="color: #cc0000;">'itemStatus'</span>];<br />
$itemQueryAddition = &#8220;&#8221;;</p>
<p><span style="color: #008000;"> if</span>($itemStatus <span style="color: #0000ff;">!=</span> <span style="color: #008000;">NULL</span>)<br />
{<br />
<span style="color: #008000;"> if</span>($itemStatus <span style="color: #0000ff;">==</span> <span style="color: #cc0000;">&#8220;done&#8221;</span>)<br />
{<br />
$itemQueryAddition = <span style="color: #cc0000;">&#8220;WHERE `$mysql_isDoneCol` = 1&#8243;</span>;<br />
} <span style="color: #008000;">else if</span> ($itemStatus == <span style="color: #cc0000;">&#8220;notDone&#8221;</span>)<br />
{<br />
$itemQueryAddition = <span style="color: #cc0000;">&#8220;WHERE `$mysql_isDoneCol` = 0&#8243;</span>;<br />
}</p>
<p><span style="color: #ff9900;"> // Construct our MySQL query</span><br />
$todoQuery = <span style="color: #cc0000;">&#8220;SELECT * FROM `$mysql_todoTable` $itemQueryAddition ;&#8221;</span>;</p>
<p><span style="color: #ff9900;"> // execute the query and gather the results&#8230;</span><br />
<span style="color: #0000ff;">mysql_select_db</span>($db, $connection);<br />
$todoResult =<span style="color: #0000ff;"> mysql_query</span>($todoQuery);<br />
$todoArray = <span style="color: #0000ff;">array()</span>;</p>
<p><span style="color: #008000;"> while</span>($itemRow <span style="color: #0000ff;">= mysql_fetch_array</span>($todoResult))<br />
{<br />
$todoArray<span style="color: #0000ff;">[] = array(</span> <span style="color: #cc0000;">&#8220;ToDoIndex&#8221;</span> <span style="color: #0000ff;">=&gt;</span> $itemRow[<span style="color: #cc0000;">'index_key'</span>],<br />
<span style="color: #cc0000;">&#8220;IsDone&#8221;</span> <span style="color: #0000ff;">=&gt;</span> $itemRow[<span style="color: #cc0000;">'is_done'</span>],<br />
<span style="color: #cc0000;">&#8220;TodoText&#8221;</span> <span style="color: #0000ff;">=&gt;</span> $itemRow[<span style="color: #cc0000;">'to_do_text'</span>] );<br />
}<br />
<span style="color: #0000ff;">mysql_close</span>($connection);</p>
<p><span style="color: #ff9900;"> // &#8230; then encode the results as JSON Text&#8230;<br />
//   we&#8217;re using a &#8220;returnType&#8221; field so that our Silverlight application can differentiate between<br />
//   the kind of return values it recieves and parse the Json object appropriately</span></p>
<p>$returnItems = <span style="color: #0000ff;">array(</span> <span style="color: #cc0000;">&#8220;returnType&#8221;</span> =&gt; &#8220;todoItems&#8221;,<br />
<span style="color: #cc0000;">&#8220;results&#8221;</span> =&gt; $returnItems);<br />
$JSONResult = json_encode($todoArray);</p>
<p><span style="color: #ff9900;"> // &#8230; and print the results so that our app can read them<br />
</span> <span style="color: #0000ff;">echo</span> $JSONResult;<br />
<span style="color: #ff0000;">?&gt;</span></p>
<p>The other two files,<strong> add_todo_item.php</strong> and <strong>change_status.php</strong> use exactly the same structure to add a new item and change the status of an existing item (respectively). I won’t put all the code here in this post that is already too long, but you can download all the files here.</p>
<p>Update the mysql_vars.php file to fit your needs and you should be able to just upload these files and have your running to-do web service all ready for Silverlight to call it for data, which is something we’ll deal with in Part 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP, MySQL and Silverlight: The Complete Tutorial (Part 1)</title>
		<link>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-1/</link>
		<comments>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-1/#comments</comments>
		<pubDate>Sun, 23 May 2010 18:56:25 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=960</guid>
		<description><![CDATA[This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”. This tutorial is geared toward someone who has never done databases or web services. Here is an example of the finished [...]]]></description>
			<content:encoded><![CDATA[<p>This is meant to be the one-stop-shop blog post for creating a very simple web service in PHP that pulls from a MySQL database and displaying the data in Silverlight. Emphasis on the “simple”. This tutorial is geared toward someone who has never done databases or web services.</p>
<p>Here is an example of the finished product (I reserve the right to clean up the data on a regular basis):</p>
<div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="500px" height="300px"><param name="source" value="http://designersilverlight.com/Silverlight/ToDo_List_Tutorial.xap"/><param name="onerror" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40818.0" /><param name="autoUpgrade" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&#038;v=3.0.40818.0" style="text-decoration: none;"><br />
				<img src="http://go.microsoft.com/fwlink/?LinkID=161376" alt="Get Microsoft Silverlight" style="border-style: none"/><br />
			</a><br />
		</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
<p>This tutorial will walk through the steps to create a simple to-do list. Our to-do list will hold text of what it is we need to do and a value indicating if the task has been done. In this tutorial, we will create a MySQL table to hold our data, a PHP service to call the data and a Silverlight application to display and interact with the data.</p>
<p><a href="http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-2/">Part 2: PHP</a></p>
<p><a href="http://www.designersilverlight.com/2010/05/24/php-mysql-and-silverlight-the-complete-tutorial-part-3/">Part 3: Silverlight</a></p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/AllFiles_PHP_and_Silverlight.zip">Download all files (PHP &#038; Silverlight)</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/PHP_Tutorial_Files.zip">Download PHP files only</a><br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/ToDo_List_Tutorial.zip">Download Silverlight project only</a></p>
<h2>Part 1: The MySQL Database</h2>
<p>First, let’s create the table we need for our data.</p>
<p>If you don’t have or don’t like phpMyAdmin, the MySQL query to create the table described below is:</p>
<p>CREATE TABLE `[your_database_name]`.`to_do_data` (<br />
`index_key` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,<br />
`is_done` TINYINT( 4 ) NOT NULL DEFAULT &#8217;0&#8242;,<br />
`to_do_text` TEXT NOT NULL ,<br />
FULLTEXT ( `to_do_text` )<br />
) ENGINE = MYISAM</p>
<p>If you have phpMyAdmin, I highly suggest using it if you’re a MySQL novice. In phpMyAdmin, go to your database and enter the name of the table you want to create in the “Create new table on database [your_db_name]” section.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0015.png"><img style="display: inline; border: 0px;" title="clip_image001[5]" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0015_thumb.png" border="0" alt="clip_image001[5]" width="445" height="105" /></a></p>
<p>We’ll call our table “to_do_data” and give it 3 fields.</p>
<ul>
<li>index_key – identifies the to-do item uniquely</li>
<li>is_done  &#8211; true/false value indicates the status of the to-do item</li>
<li>to_do_text &#8211; a short text to describe what needs to be done</li>
</ul>
<p>In phpMyAdmin, it will look like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0011.png"><img style="display: inline; border: 0px;" title="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image001_thumb1.png" border="0" alt="clip_image001" width="735" height="343" /></a></p>
<p>A couple of notes about the fields:</p>
<p><strong>index_key</strong></p>
<p>This is the primary key of the table and is used to uniquely identify the given row. As such, it cannot be null and it auto-increments as rows are added to the table.</p>
<p><strong>is_done</strong></p>
<p>We use “TINYINT” type for this value because <a href="http://stackoverflow.com/questions/289727/which-mysql-datatype-to-use-for-storing-boolean-values-from-to-php">using BOOLEAN is basically the same thing</a>. It is not null because every item must either be “done” or “not done”. “Done” = true = 1 and “not done” = false = 0. We are going to default to “0” (false) because we’re assuming that users aren’t going to make a to do list of stuff that is already complete.</p>
<p><strong>to_do_text</strong></p>
<p>We have artificially limited the text size to 1024 because we assume that this will be a set of short to-dos to, not a set of journal entries. We’ve also turned on “Fulltext” which lets the MySQL database index our entries for quick searching.</p>
<p>Now we just click the “Save” button at the bottom and we have our table.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0017.png"><img style="display: inline; border: 0px;" title="clip_image001[7]" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image0017_thumb.png" border="0" alt="clip_image001[7]" width="794" height="105" /></a></p>
<p>Now our database system is in place and we’re ready to write a PHP webservice to implement all the CRUD (create, read, update, delete) capabilities our system will need.</p>
<p>If you want to learn more about MySQL, I highly recommend &#8220;<a href="http://www.amazon.com/gp/product/0471412767?ie=UTF8&#038;tag=irrationalopt-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0471412767">A Visual Introduction to SQL</a><img src="http://www.assoc-amazon.com/e/ir?t=irrationalopt-20&#038;l=as2&#038;o=1&#038;a=0471412767" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />&#8220;. This is the book I have, a left-over of my grad school years and it is an exceptional book for picking your way through various database scenarios. </p>
<p>If you&#8217;re looking for something a bit less costly, &#8220;<a href="http://www.amazon.com/gp/product/0672327120?ie=UTF8&#038;tag=irrationalopt-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0672327120">MySQL Crash Course</a><img src="http://www.assoc-amazon.com/e/ir?t=irrationalopt-20&#038;l=as2&#038;o=1&#038;a=0672327120" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />&#8221; is a fine book on the subject as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovery Review: A Silverlight Sunlight Foundation Visualization Project</title>
		<link>http://www.designersilverlight.com/2010/05/22/recovery-review-a-silverlight-sunlight-foundation-visualization-project/</link>
		<comments>http://www.designersilverlight.com/2010/05/22/recovery-review-a-silverlight-sunlight-foundation-visualization-project/#comments</comments>
		<pubDate>Sat, 22 May 2010 17:02:44 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[Design For America]]></category>
		<category><![CDATA[Sunlight Foundation]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2010/05/22/recovery-review-a-silverlight-sunlight-foundation-visualization-project/</guid>
		<description><![CDATA[If you’re interested in government transparency, there is not better organization to watch than the Sunlight Foundation, a non-profit organization that is leading the charge to more government transparency through the release, organization and visualization of government data and processes. Every once in a while, Sunlight Foundation runs contests to either visualize or interact with [...]]]></description>
			<content:encoded><![CDATA[<p>If you’re interested in government transparency, there is not better organization to watch than the <a href="http://sunlightfoundation.com/">Sunlight Foundation</a>, a non-profit organization that is leading the charge to more government transparency through the release, organization and visualization of government data and processes. </p>
<p>Every once in a while, Sunlight Foundation runs contests to either visualize or interact with government data. I submitted a Silverlight project called “<a href="http://recoveryinteract.com">Recovery Review</a>” for the latest contest, “<a href="http://sunlightlabs.com/contests/designforamerica/">Design for America</a>”. With Recovery Review, users can search and visualize stimulus projects. If they find information that they think is inaccurate, they can flag that project for inaccurate information. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image001.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image001_thumb.png" width="644" height="436" /></a></p>
<p>The idea behind the visualization is that users can search through the data using a couple of key points (how much money was awarded to a project, where the project is, how many jobs were reported as “saved or created” due to the project, etc) and the system will deliver in a visual format a set of results that match that search. It will also visualize (as seen above) the total of all awards that match that search in the context of the stimulus awarded as a whole. </p>
<p>If the user clicks on the on one of the projects in the list, the visualization resizes so the user can see how much money and how many jobs that individual project represents, both in relation to the search total and in relation to the total stimulus.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image00114.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image001[14]" border="0" alt="clip_image001[14]" src="http://www.designersilverlight.com/wp-content/uploads/2010/05/clip_image00114_thumb.png" width="398" height="322" /></a></p>
<p>Here’s a video overview of the project (runs about 8 mins).</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/voGzKi1kxCw&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/voGzKi1kxCw&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object></p>
<p>And <a href="http://recoveryinteract.com/blog/?p=20">here is a blog post for the project</a> that discusses some of the design decisions made and what I would change given more time.</p>
<p>Looking at the competition, I find it unlikely that I will win, but building the project was a pretty exciting learning experience. I’ll be posting my lessons here in the next couple weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2010/05/22/recovery-review-a-silverlight-sunlight-foundation-visualization-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code for MIX10 Information Visualization Talk Demos</title>
		<link>http://www.designersilverlight.com/2010/03/18/code-for-mix10-information-visualization-talk-demos/</link>
		<comments>http://www.designersilverlight.com/2010/03/18/code-for-mix10-information-visualization-talk-demos/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 22:40:36 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[information visualization]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[demos]]></category>
		<category><![CDATA[info viz]]></category>
		<category><![CDATA[MIX10]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=902</guid>
		<description><![CDATA[As promised, I&#8217;m posting my code for the demos from my MIX10 &#8220;Creating Effective Information Visualization in Silverlight&#8221; talk. Unemployment Data Demo Code Bing Maps Twitter Demo Code In case you want to take a look at the unemployment visualization, I&#8217;ve added it below. I&#8217;m looking for a place to do ASP.Net hosting because my [...]]]></description>
			<content:encoded><![CDATA[<p>As promised, I&#8217;m posting my code for the demos from my MIX10 &#8220;Creating Effective Information Visualization in Silverlight&#8221; talk.</p>
<p><a href="http://www.designersilverlight.com/Silverlight/UnemploymentViz.zip">Unemployment Data Demo  Code</a></p>
<p><a href="http://www.designersilverlight.com/Silverlight/BingSLTest_Demo.zip">Bing Maps Twitter Demo Code</a></p>
<p>In case you want to take a look at the unemployment visualization, I&#8217;ve added it below. I&#8217;m looking for a place to do ASP.Net hosting because my Bing Maps visualization is driven using Twitter data called and served through a WCF service, so if you have a recommendation for a noob ASP.Net guy, let me know. I&#8217;d love to host that as well.</p>
<p>(Apparently some people are having trouble with my demo below. I&#8217;ll try to get a more compatible version up soon.)</p>
<p> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="800px" height="600px"><param name="source" value="http://www.designersilverlight.com/Silverlight/UnemploymentViz.xap"/><param name="onError" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40818.0" /><param name="autoUpgrade" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&#038;v=3.0.40818.0" style="text-decoration:none"><br />
 			  <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/><br />
		  </a><br />
	    </object></p>
<p>You can copy the code for to embed this with the text below:</p>
<p><textarea rows="7" cols="100">&lt;object data=&#8221;data:application/x-silverlight-2,&#8221; type=&#8221;application/x-silverlight-2&#8243; width=&#8221;800px&#8221; height=&#8221;600px&#8221;&gt;&lt;param name=&#8221;source&#8221; value=&#8221;http://www.designersilverlight.com/Silverlight/UnemploymentViz.xap&#8221;/&gt; &lt;param name=&#8221;onError&#8221; value=&#8221;onSilverlightError&#8221; /&gt; &lt;param name=&#8221;background&#8221; value=&#8221;white&#8221; /&gt;&lt;param name=&#8221;minRuntimeVersion&#8221; value=&#8221;3.0.40818.0&#8243; /&gt;&lt;param name=&#8221;autoUpgrade&#8221; value=&#8221;true&#8221; /&gt;&lt;a href=&#8221;http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40818.0&#8243; style=&#8221;text-decoration:none&#8221;&gt;&lt;img src=&#8221;http://go.microsoft.com/fwlink/?LinkId=108181&#8243; alt=&#8221;Get Microsoft Silverlight&#8221; style=&#8221;border-style:none&#8221;/&gt;&lt;br /&gt; &lt;/a&gt;&lt;/object&gt;</textarea></p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2010/03/18/code-for-mix10-information-visualization-talk-demos/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Info Vis, Snapping Behaviors, Illustrator Guidance and Custom Control Stuff</title>
		<link>http://www.designersilverlight.com/2009/09/10/info-vis-snapping-behaviors-illustrator-guidance-and-custom-control-stuff/</link>
		<comments>http://www.designersilverlight.com/2009/09/10/info-vis-snapping-behaviors-illustrator-guidance-and-custom-control-stuff/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 21:04:17 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[Helpful Links]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 3]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[custom-control]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=830</guid>
		<description><![CDATA[I&#8217;ve been a busy blogger over at Veracity Blogs the last couple weeks. Here&#8217;s a list of my new posts: Florida Crime Rate Visualization &#8211; My attempts to use Silverlight for information visualizations are going pretty well. In this post, I visualize the Florida crime rate by county over almost 20 years. There are project [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a busy blogger over at Veracity Blogs the last couple weeks. Here&#8217;s a list of my new posts:</p>
<ul>
<li><a href="http://blogs.veracitysolutions.com/florida-crime-rates-an-information-visualization-in-silverlight/">Florida Crime Rate Visualization</a> &#8211; My attempts to use Silverlight for information visualizations are going pretty well. In this post, I visualize the Florida crime rate by county over almost 20 years. There are project files availalbe for anyone who wants to dig into how I did it a little more. </li>
<li><a href="http://blogs.veracitysolutions.com/adobe-illustrator-to-xaml-conversion-options/">Adobe Illustrator to XAML Conversion Options</a> &#8211; This post walks through the pros and cons of two methods for taking an SVG file (or Adobe Illustrator) file and pulling it into Blend as a XAML file. It also has a XAML copy of a vector map of the US by county for download.</li>
<li><a href="http://blogs.veracitysolutions.com/create-a-snapping-slider-in-blend-using-behaviors-silverlight-3-or-wpf/">Create A Snapping Slider In Blend Using Behaviors</a> &#8211; This provides a downloadable behavior for getting a slider to snap to integers (or an integer multiple based on certain settings). I&#8217;ve provided project files as well as a tutorial for how to do it.</li>
<li><a href="http://blogs.veracitysolutions.com/how-to-create-a-part-in-your-silverlight-custom-control/">How To Create a PART in Your Silverlight Custom Control</a> &#8211; Because there are about a dozen tutorials on building a custom control, but I keep forgetting exactly how to do this part of it.</li>
<li><a href="http://blogs.veracitysolutions.com/how-to-animate-a-changing-property-in-a-custom-control-in-silverlight/">How To Animate a Changing Property in a Custom Control in Silverlight</a> &#8211; Have you ever wanted your property to animation automatically when it changes in your Silverlight Custom Control. I say, &#8220;Who hasn&#8217;t!?&#8221; at which point my wife forces me out into the fresh air and sunshine (or, as I call it, the Blinding Day Star). After I scurry back inside, I wrote this blog post.</li>
<li><a href="http://blogs.veracitysolutions.com/how-to-build-a-storyboard-animation-in-c-sharp/">How To Build a Storyboard Animation for Silverlight in C#</a> &#8211; Because sometimes you want to enjoy the benefits of the Silverlight animation engine but you really need to build the animation in the code instead of the XAML.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/09/10/info-vis-snapping-behaviors-illustrator-guidance-and-custom-control-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Silverlight Posts at Veracity Blogs</title>
		<link>http://www.designersilverlight.com/2009/08/19/new-silverlight-posts-at-veracity-blogs/</link>
		<comments>http://www.designersilverlight.com/2009/08/19/new-silverlight-posts-at-veracity-blogs/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 16:09:27 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[styles]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=732</guid>
		<description><![CDATA[I&#8217;ve started a series of posts on Silverlight and other topics over at the Veracity Solutions Blog. Veracity Solutions is the software consulting firm where I work and we&#8217;ve decided that it would be a good idea to do some sponsored posting there. Blog posts up so far are: Styling a ComboBox in Silverlight 3 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started a series of posts on Silverlight and other topics over at the Veracity Solutions Blog.</p>
<p>Veracity Solutions is the software consulting firm where I work and we&#8217;ve decided that it would be a good idea to do some sponsored posting there.</p>
<p>Blog posts up so far are:</p>
<ul>
<li><a href="http://blogs.veracitysolutions.com/styling-a-combobox-in-silverlight-3/">Styling a ComboBox in Silverlight 3</a></li>
<li><a href="http://blogs.veracitysolutions.com/how-to-wrap-text-in-a-silverlight-3-combobox/">How To Wrap Text In a Silverlight 3 ComboBox</a></li>
<li><a href="http://blogs.veracitysolutions.com/how-to-get-a-silverlight-3-autocompletebox-to-show-sample-data-in-blend-3/">How To Get a Silverlight 3 AutoCompleteBox to Show Sample Data In Blend 3</a></li>
<li><a href="http://blogs.veracitysolutions.com/how-to-create-a-listbox-with-checkboxes-or-radiobuttons-in-silverlight-3/">How To Create A ListBox with CheckBoxes (or RadioButtons) In Silverlight 3</a></li>
</ul>
<p>More are coming, including tutorials on behaviors and paths.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/08/19/new-silverlight-posts-at-veracity-blogs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>INotifyPropertyChanged Snippets (And Why You Should Use These Instead of DependencyProperties)</title>
		<link>http://www.designersilverlight.com/2009/04/30/inotifypropertychanged-snippets-and-why-you-should-use-these-instead-of-dependencyproperties/</link>
		<comments>http://www.designersilverlight.com/2009/04/30/inotifypropertychanged-snippets-and-why-you-should-use-these-instead-of-dependencyproperties/#comments</comments>
		<pubDate>Fri, 01 May 2009 01:53:56 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Advanced Tutorial]]></category>
		<category><![CDATA[Binding]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2009/04/30/inotifypropertychanged-snippets-and-why-you-should-use-these-instead-of-dependencyproperties/</guid>
		<description><![CDATA[First things first, here are my INotifyPropertyChanged snippets. INotifyPropertyChanged snippet (PropertyChangedEventHandler and RaisePropertyChanged method) INotifyPropertyChanged Property snippet Just download them into your &#34;Visual Studio 2008CodeSnippetsVisual C#My CodeSnippets&#34; folder and they should work. Just type &#34;notify&#34; and intellisense should show you &#34;notifyo&#34; (for NotifyObject) and &#34;notifyp&#34; (for NotifyProperty). Hit tab twice and the code should dump [...]]]></description>
			<content:encoded><![CDATA[<p>First things first, here are my INotifyPropertyChanged snippets. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/04/notifyo.snippet">INotifyPropertyChanged snippet (PropertyChangedEventHandler and RaisePropertyChanged method)</a></p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/04/notify_p.snippet">INotifyPropertyChanged Property snippet</a></p>
<p>Just download them into your &quot;Visual Studio 2008CodeSnippetsVisual C#My CodeSnippets&quot; folder and they should work. Just type &quot;notify&quot; and intellisense should show you &quot;notifyo&quot; (for NotifyObject) and &quot;notifyp&quot; (for NotifyProperty). Hit tab twice and the code should dump into your project.</p>
<p>This is definitely a &quot;use at your own risk&quot; project. </p>
<p>You see, there I was, minding my own business and trying to build some data to use with some XAML comps I was playing with and I was having some of the strangest things happen with my data. I had a DependecyProperty ObservableCollection in my ViewModel and I put a couple different views in my screen. (I was using an MVVM pattern, because that&#8217;s what all the kool kids are doing.) </p>
<p>Then, it suddenly seemed as if all my Views were sharing the same ObservableCollection, even though every other DependencyProperty they were bound to had unique values. So I did what I always do when I have problems like this&#8230; I ask <a href="http://xamlcoder.com/cs/blogs/joe/default.aspx">Joe McBride</a>.</p>
<p>It turns out I had gotten confused. I understood that DependencyProperties were good for the following:</p>
<ul>
<li>Providing callbacks when the property is changed</li>
<li>Binding to stuff</li>
<li>Animations</li>
</ul>
<p>I figured that this is the kind of behavior I wanted from my data. I was wrong. As it turns out that is the kind of behavior I want out of the properties that I use in my <em>WPF and Silverlight controls</em>. It seems that DependencyProperties are meant to be <em>used with controls and not for stand-alone data</em>. </p>
<p>For stand-alone data, I should have used INotifyPropertyChanged, which is an interface for&#8230; well&#8230; notifying things when a property changes. I already had handy snippets for creating DependencyProperties (thanks to <a href="http://labs.nerdplusart.com/">Robby Ingebretsen</a>). So I tweaked his snippets so that they work for INotifyPropertyChanged properties.</p>
<p>Because it seems silly to implement the PropertyChangedEventHandler in every class that needs notify-able properties, I like to create a &quot;NotifyObject&quot; class:</p>
<p><span style="color: blue">class </span><span style="color: #2b91af">NotifyObject </span>: <span style="color: #2b91af">INotifyPropertyChanged     <br /></span>{    <br />&#160;&#160;&#160; <span style="color: blue">public event </span><span style="color: #2b91af">PropertyChangedEventHandler </span>PropertyChanged;    </p>
<p>&#160;&#160;&#160; <span style="color: blue">protected void </span>RaisePropertyChanged(<span style="color: blue">string </span>propertyName)    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">var </span>handler = PropertyChanged;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span>(handler != <span style="color: blue">null</span>)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; handler(<span style="color: blue">this</span>, <span style="color: blue">new </span><span style="color: #2b91af">PropertyChangedEventArgs</span>(propertyName));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />}</p>
<p>Then, I can make my new class inherit from NotifyObject and away I go creating my bindable, notify-able data:</p>
<p><span style="color: blue">public class </span><span style="color: #2b91af">MyNotifyableData </span>: <span style="color: #2b91af">NotifyObject     <br /></span>{    <br />&#160;&#160;&#160; <span style="color: blue">public </span>MyNotifyableData()    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160; }    </p>
<p>&#160;&#160;&#160; <span style="color: blue">#region </span>MyProperty (INotifyPropertyChanged Property)    <br />&#160;&#160;&#160; <span style="color: blue">private string </span>_myProperty;    </p>
<p>&#160;&#160;&#160; <span style="color: blue">public string </span>MyProperty    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">get </span>{ <span style="color: blue">return </span>_myProperty; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">set     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; _myProperty = <span style="color: blue">value</span>;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RaisePropertyChanged(<span style="color: #a31515">&quot;MyProperty&quot;</span>);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }    <br />&#160;&#160;&#160; <span style="color: blue">#endregion     <br /></span>}</p>
<p>This property was created using my snippet above. Hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/04/30/inotifypropertychanged-snippets-and-why-you-should-use-these-instead-of-dependencyproperties/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Source Code For Presidential Candidate Tracker Visualization</title>
		<link>http://www.designersilverlight.com/2009/02/26/source-code-for-presidential-candidate-tracker-visualization/</link>
		<comments>http://www.designersilverlight.com/2009/02/26/source-code-for-presidential-candidate-tracker-visualization/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 01:19:54 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[MIX09]]></category>
		<category><![CDATA[New York Times API]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=586</guid>
		<description><![CDATA[Due to repeated requests for the source code (and the fact that I apparently can&#8217;t brag about it on Silverlight.Net without a link to the source code), I&#8217;m putting it up for download. Presidential Candidate News Tracker Source Code JSON Data File With Candidate Data (Note: Apparently, WordPress likes to uncapitalize file names for me, [...]]]></description>
			<content:encoded><![CDATA[<p>Due to repeated requests for the source code (and the fact that I apparently can&#8217;t brag about it on Silverlight.Net without a link to the source code), I&#8217;m putting it up for download. </p>
<p><a href='http://www.designersilverlight.com/wp-content/uploads/2009/02/newyorktimessilverlightvisualization.zip'>Presidential Candidate News Tracker Source Code</a></p>
<p><a href='http://www.designersilverlight.com/wp-content/uploads/2009/02/canddata.json'>JSON Data File With Candidate Data</a> (Note: Apparently, WordPress likes to uncapitalize file names for me, you may have to re-name the file to &#8220;CandData.json&#8221; to get it to work with the app.)</p>
<p>Warning: This code is a disaster. I was having strange problems getting my custom controls to work and, after a couple hours fighting with it, I gave up and ended up writing the exact same layout and code for 14 separate candidates. Same problem with the &#8220;dates-of-note&#8221; along the timeline.</p>
<p>Not pretty, but it works. Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/02/26/source-code-for-presidential-candidate-tracker-visualization/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using Silverlight to Display JSON Data (Collected From The New York Times API)</title>
		<link>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/</link>
		<comments>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 07:36:00 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Binding]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[without a line of code]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/</guid>
		<description><![CDATA[In this post, you’ll either need to walk through this tutorial on how to call and prepare JSON data gathered from the New York Times API or, if you’re not particularly interested in doing that, you can just download the final project here. This tutorial pretty much assumes that you’re starting from the end of [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, you’ll either need to walk through this tutorial on <a href="http://www.designersilverlight.com/2009/02/25/adventures-with-json-and-silverlight-and-the-new-york-times/">how to call and prepare JSON data gathered from the New York Times API</a> or, if you’re not particularly interested in doing that, <a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/jsonnewyorktimestutorial_part_1.zip">you can just download the final project here</a>. This tutorial pretty much assumes that you’re starting from the end of that tutorial.</p>
<p>Fortunately for everyone involved (especially me), this tutorial is much shorter. It is also another in my “without a line of code” series in which you can do everything without even touching the code. Let’s open up our project in Blend and get started. (To see an example what this tutorial makes, scroll to the bottom of this post.)</p>
<p>First of all, I lied. You do have to touch one line of code because <a href="http://developer.nytimes.com/apps/register">you need to get your NYT API key</a> and plug it into the myApiKey variable in the Page constructor (line 26 in the project available for download). The line should look like this:</p>
<p>myApiKey = <span style="color: #a31515">&#8220;&amp;api-key=your_api_key_here&#8221;</span>;</p>
<p>Now, right click on the project solution and select “Build Solution” (in Visual Studio or Blend, it doesn’t matter).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0011.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001-thumb1.png" border="0" alt="clip_image001" width="349" height="149" /></a></p>
<p>This should build the assemblies so that Blend can do a really neat trick. In the Project tab in Blend, you should see a Data panel in the bottom half. Click on the &#8220;+ CLR Object” button.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00151.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[5]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0015-thumb1.png" border="0" alt="clip_image001[5]" width="298" height="60" /></a></p>
<p>A pop-up will gently encourage you to name your new data source and choose from a list of available data sources. Select “NYTResult” and hit OK.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00171.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[7]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0017-thumb1.png" border="0" alt="clip_image001[7]" width="398" height="228" /></a></p>
<p>You will now have your NYTResult data source show up in your Data pane. Before we start building a nice slick looking interface, select your ListBox (named “ResultsDisplay”) and, in the Properties pane, find the “Display Member Path” and reset it by clicking on the little gray box to the right.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001131.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[13]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00113-thumb1.png" border="0" alt="clip_image001[13]" width="298" height="170" /></a></p>
<p>Now, right-click on the ListBox  in your “Objects and Timeline” panel and select “Bind ItemsSource to Data…”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00191.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[9]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0019-thumb1.png" border="0" alt="clip_image001[9]" width="269" height="263" /></a></p>
<p>Select the data source you just created and select “NYTResult”. Then click on “Define DataTemplate” at the bottom. This will take you to the “Create Data Template” panel, where the fun happens. You will see “New Data Template and Display Fields” automatically selected. We like this. This lets us select all the data we want and give it some basic structure and Blend will do all the bindings for us.</p>
<p>Let’s make a few changes from the standard Data Template setup. Expand the Date field and check Day, DayOfWeek, Month, and Year and change the order with the up and down buttons to something you like. Then, change the Url from “StackPanel” to “TextBlock”. I reordered the data a little bit, so my template looks like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001151.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[15]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00115-thumb1.png" border="0" alt="clip_image001[15]" width="332" height="321" /></a></p>
<p>Hit OK. The point of that whole exercise was so that Blend would build our data template for us. We don’t actually want the data source and we don’t want our ListBox bound to it. So reset the “ItemSource” property on the ListBox and remove the NYTResult data source. If you run the project now, you should get something like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00117.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[17]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00117-thumb.png" border="0" alt="clip_image001[17]" width="411" height="309" /></a></p>
<p>At least we’re getting more data now. Doesn’t look that great, but we’re getting there. Go back to your project in Blend and right-click on your ListBox and go to “Edit Other Templates –&gt; Edit Generated Items (ItemTemplate) –&gt; Edit Template”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00119.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[19]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00119-thumb.png" border="0" alt="clip_image001[19]" width="555" height="344" /></a></p>
<p>We’re now in the DataTemplate but we sadly have no visible data, which makes manipulating it a tad difficult. What I have found works best for me is just to build my desired layout with static data and then translate the bindings. (I haven’t mentioned this, but <a href="http://www.designersilverlight.com/2009/02/04/6-tips-for-designers-for-translating-your-comps-into-xaml/">you should be working in Split mode as a general rule</a>, so you should be able to see the bindings in the XAML.)</p>
<p>So… long story short (it’s getting really late here): I changed the layout to replicate the NYT story design… the Title is a hyperlink button that takes us to the full story, followed by a small byline, the beginning of the story and the date on which the story appeared. If you’d like to look at the design itself in more detail, download the project at the end of this post.</p>
<p>I do want to mention one issue… the issue of getting your text to wrap. With my current redesigned DataTemplate, my project looks like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00121.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[21]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00121-thumb.png" border="0" alt="clip_image001[21]" width="411" height="311" /></a></p>
<p>It scrolls horizontally to a degree that is certainly unhealthy. What is happening is that the TextBlock in the DataTemplate is making a request for space and when it hits a limit, it will start wrapping. Unfortunately for us, when the ScrollViewer in the ListBox has the HorizontalScrollBarVisibility set to “Auto”, it is telling the TextBlock that it has all the room in the world and that it doesn’t need to wrap. So, let’s just change the HorizontalScrollBarVisibility on the ListBox to “Disabled”.</p>
<p>And we’re done.</p>
<p><iframe src="http://silverlight.services.live.com/invoke/77530/JSON_NYT_Tutorial_Part_2/iframe.html" scrolling="no" frameborder="0" style="width:400px; height:500px"></iframe></p>
<p>You can download the source here</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/jsonnewyorktimestutorial_part_2.zip">JSON &#8211; Silverlight &#8211; New York Times Tutorial (Part 2) Project Files</a></p>
<p>Questions and comments are always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
