<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Silverlight, WPF and Windows 8 Development</title>
	<atom:link href="http://vortexwolf.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vortexwolf.wordpress.com</link>
	<description>Articles about applications development with XAML and C#</description>
	<lastBuildDate>Wed, 15 May 2013 08:26:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vortexwolf.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Silverlight, WPF and Windows 8 Development</title>
		<link>http://vortexwolf.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vortexwolf.wordpress.com/osd.xml" title="Silverlight, WPF and Windows 8 Development" />
	<atom:link rel='hub' href='http://vortexwolf.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Silverlight sparkline chart</title>
		<link>http://vortexwolf.wordpress.com/2013/05/07/silverlight-sparkline-chart/</link>
		<comments>http://vortexwolf.wordpress.com/2013/05/07/silverlight-sparkline-chart/#comments</comments>
		<pubDate>Tue, 07 May 2013 20:29:07 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Chart]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=393</guid>
		<description><![CDATA[According to Wikipedia A sparkline is a very small line chart, typically drawn without axes or coordinates. Though this chart is not included by default to the Silverlight Toolkit library, it is very easy to implement such chart by styling the built-in Line chart. Here is an example which I&#8217;ve implemented: At first I&#8217;ve changed [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=393&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>According to <a href="http://en.wikipedia.org/wiki/Sparkline" title="Sparkline">Wikipedia</a></p>
<blockquote><p>A sparkline is a very small line chart, typically drawn without axes or coordinates.</p></blockquote>
<p>Though this chart is not included by default to the Silverlight Toolkit library, it is very easy to implement such chart by styling the built-in Line chart. Here is an example which I&#8217;ve implemented:</p>
<p><a href="http://vortexwolf.files.wordpress.com/2013/05/silverlight_sparkline_sample.png"><img src="http://vortexwolf.files.wordpress.com/2013/05/silverlight_sparkline_sample.png?w=630" alt="silverlight_sparkline_sample"   class="alignnone size-full wp-image-394" /></a></p>
<p>At first I&#8217;ve changed the default control template of the Chart control, I&#8217;ve removed all paddings, the chart title, and reduced the minimum height and width of the chart. Also I&#8217;ve changed the DataPoint template (made them invisible) and the Polyline template (reduced its thickness). Here is the XAML code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;UserControl.Resources&gt;
    &lt;Style x:Key=&quot;ChartWithoutPaddings&quot; TargetType=&quot;chart:Chart&quot;&gt;
        &lt;Setter Property=&quot;Padding&quot; Value=&quot;0&quot; /&gt;
        &lt;Setter Property=&quot;BorderThickness&quot; Value=&quot;0&quot; /&gt;
        &lt;Setter Property=&quot;ChartAreaStyle&quot;&gt;
            &lt;Setter.Value&gt;
                &lt;Style TargetType=&quot;Panel&quot;&gt;
                    &lt;Setter Property=&quot;MinWidth&quot; Value=&quot;100&quot; /&gt;
                    &lt;Setter Property=&quot;MinHeight&quot; Value=&quot;20&quot; /&gt;
                &lt;/Style&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
        &lt;Setter Property=&quot;PlotAreaStyle&quot;&gt;
            &lt;Setter.Value&gt;
                &lt;Style TargetType=&quot;Grid&quot;&gt;
                    &lt;Setter Property=&quot;Background&quot; Value=&quot;Transparent&quot; /&gt;
                &lt;/Style&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
        &lt;Setter Property=&quot;Template&quot;&gt;
            &lt;Setter.Value&gt;
                &lt;ControlTemplate TargetType=&quot;chart:Chart&quot;&gt;
                    &lt;Border Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; Padding=&quot;{TemplateBinding Padding}&quot;&gt;
                        &lt;chartingprimitives:EdgePanel x:Name=&quot;ChartArea&quot; Style=&quot;{TemplateBinding ChartAreaStyle}&quot;&gt;
                            &lt;Grid Canvas.ZIndex=&quot;-1&quot; Style=&quot;{TemplateBinding PlotAreaStyle}&quot; /&gt;
                        &lt;/chartingprimitives:EdgePanel&gt;
                    &lt;/Border&gt;
                &lt;/ControlTemplate&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
    &lt;/Style&gt;

    &lt;Style x:Key=&quot;EmptyDataPoint&quot; TargetType=&quot;Control&quot;&gt;
        &lt;Setter Property=&quot;Background&quot; Value=&quot;Black&quot; /&gt;
        &lt;Setter Property=&quot;Template&quot; Value=&quot;{x:Null}&quot; /&gt;
    &lt;/Style&gt;

    &lt;Style x:Key=&quot;OnePixelLine&quot; TargetType=&quot;Polyline&quot;&gt;
        &lt;Setter Property=&quot;StrokeThickness&quot; Value=&quot;1&quot; /&gt;
    &lt;/Style&gt;
&lt;/UserControl.Resources&gt;
</pre>
<p>This code is almost all that you need to create a sparkline chart. All that is left is to remove axes. It wasn&#8217;t a trivial thing, so I used some kind of a hack: I set their width (for Y axis) and height (for X axis) to zero.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;chart:Chart Style=&quot;{StaticResource ChartWithoutPaddings}&quot;&gt;
    &lt;chart:LineSeries ItemsSource=&quot;{Binding FirstIndexItems}&quot; IndependentValuePath=&quot;Number&quot; DependentValuePath=&quot;Value&quot; 
                        DataPointStyle=&quot;{StaticResource EmptyDataPoint}&quot; 
                        PolylineStyle=&quot;{StaticResource OnePixelLine}&quot;  /&gt;
    &lt;chart:Chart.Axes&gt;
        &lt;chart:LinearAxis Orientation=&quot;X&quot; Height=&quot;0&quot; Opacity=&quot;0&quot; /&gt;
        &lt;chart:LinearAxis Orientation=&quot;Y&quot; Width=&quot;0&quot; Opacity=&quot;0&quot; /&gt;
    &lt;/chart:Chart.Axes&gt;
&lt;/chart:Chart&gt;
</pre>
<p>
<strong>Links</strong><br />
Source code: <a href="https://dl.dropboxusercontent.com/u/8047386/WordPress/SparklineChartSample.zip" title="Sparkline Chart Source Code">SparklineChartSample.zip</a><br />
Showcase: <a href="https://dl.dropboxusercontent.com/u/8047386/WordPress/SilverlightChart/SparklineChart/SparklineChartSampleTestPage.html" title="Sparkline Chart Sample Test Page">SparklineChartSampleTestPage.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=393&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/05/07/silverlight-sparkline-chart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/05/silverlight_sparkline_sample.png" medium="image">
			<media:title type="html">silverlight_sparkline_sample</media:title>
		</media:content>
	</item>
		<item>
		<title>19 invitations to careers.stackoverflow.com giveaway</title>
		<link>http://vortexwolf.wordpress.com/2013/04/26/19-invitations-to-careers-stackoverflow-com-giveaway/</link>
		<comments>http://vortexwolf.wordpress.com/2013/04/26/19-invitations-to-careers-stackoverflow-com-giveaway/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 19:08:45 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=388</guid>
		<description><![CDATA[Maybe http://careers.stackoverflow.com will be useful for someone, so I have 19 invitations that I don&#8217;t need. You can post your email in comments bellow or send me a request to my email vortexwolf@gmail.com and I will send you an invitation to this website. It could be better to create a shareable link, but I would [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=388&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Maybe <a href="http://careers.stackoverflow.com">http://careers.stackoverflow.com</a> will be useful for someone, so I have 19 invitations that I don&#8217;t need.</p>
<p>You can post your email in comments bellow or send me a request to my email vortexwolf@gmail.com and I will send you an invitation to this website.</p>
<p><a href="http://vortexwolf.files.wordpress.com/2013/04/invitations-carreer-stackexchange.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/invitations-carreer-stackexchange.png?w=630&#038;h=412" alt="invitations carreer stackexchange" width="630" height="412" class="alignnone size-large wp-image-389" /></a></p>
<p>It could be better to create a shareable link, but I would rather send invitations in person. </p>
<p>The proposal remains valid as long as you see this post. If I don&#8217;t have invitations, I will delete the post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/388/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=388&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/04/26/19-invitations-to-careers-stackoverflow-com-giveaway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/invitations-carreer-stackexchange.png?w=630" medium="image">
			<media:title type="html">invitations carreer stackexchange</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Phone Marketplace app submitting</title>
		<link>http://vortexwolf.wordpress.com/2013/04/22/windows-phone-marketplace-app-submitting/</link>
		<comments>http://vortexwolf.wordpress.com/2013/04/22/windows-phone-marketplace-app-submitting/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 14:20:43 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[marketplace]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=375</guid>
		<description><![CDATA[In this article I will show how the windows phone marketplace looks and how to publish apps there. When you click the Submit App link, you will see the following page: If you click the square with the number 1, you will see the App Info page: All that you need to fill out is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=375&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this article I will show how the windows phone marketplace looks and how to publish apps there.</p>
<p>When you click the Submit App link, you will see the following page:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/mainpage.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/mainpage.png?w=287&#038;h=300" alt="mainpage" width="287" height="300" class="alignnone size-medium wp-image-376" /></a></p>
<p><span id="more-375"></span><br />
If you click the square with the number 1, you will see the App Info page:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/appinfo.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/appinfo.png?w=249&#038;h=300" alt="appinfo" width="249" height="300" class="alignnone size-medium wp-image-378" /></a></p>
<p>All that you need to fill out is the App Alias field (i.e. the name of your application) and the Category combobox. That&#8217;s all, you can go to the second step:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/appinfo_created.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/appinfo_created.png?w=300&#038;h=178" alt="appinfo_created" width="300" height="178" class="alignnone size-medium wp-image-379" /></a></p>
<p>If you click the square with the number 2, you will see a page with the Browse link where you should upload your xap file:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/uploadxaml.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/uploadxaml.png?w=300&#038;h=190" alt="uploadxaml" width="300" height="190" class="alignnone size-medium wp-image-381" /></a></p>
<p>After that the page will become much longer and will contain several sections. The first section displays information about your xap file:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded1.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded1.png?w=292&#038;h=300" alt="xaml_uploaded1" width="292" height="300" class="alignnone size-medium wp-image-382" /></a></p>
<p>In the second section you can write a description of your application that will be displayed to end users:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded2.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded2.png?w=300&#038;h=288" alt="xaml_uploaded2" width="300" height="288" class="alignnone size-medium wp-image-383" /></a></p>
<p>And finally, you should upload a square 300&#215;300 icon and at least 1 screenshot of your application:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded3.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded3.png?w=190&#038;h=300" alt="xaml_uploaded3" width="190" height="300" class="alignnone size-medium wp-image-384" /></a></p>
<p>Then your application will be submitted and it takes 3 days until it is reviewed and either approved or rejected.</p>
<p>After the application is approved and is visible on the marketplace, you can update your application in a similar way. The update process is almost the same and you will need to wait 3 days as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=375&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/04/22/windows-phone-marketplace-app-submitting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/mainpage.png?w=287" medium="image">
			<media:title type="html">mainpage</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/appinfo.png?w=249" medium="image">
			<media:title type="html">appinfo</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/appinfo_created.png?w=300" medium="image">
			<media:title type="html">appinfo_created</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/uploadxaml.png?w=300" medium="image">
			<media:title type="html">uploadxaml</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded1.png?w=292" medium="image">
			<media:title type="html">xaml_uploaded1</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded2.png?w=300" medium="image">
			<media:title type="html">xaml_uploaded2</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/xaml_uploaded3.png?w=190" medium="image">
			<media:title type="html">xaml_uploaded3</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Phone display images from URL</title>
		<link>http://vortexwolf.wordpress.com/2013/04/04/windows-phone-display-images-from-url/</link>
		<comments>http://vortexwolf.wordpress.com/2013/04/04/windows-phone-display-images-from-url/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 15:14:22 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=361</guid>
		<description><![CDATA[The built-in Image element is quite good for loading and displaying images from the web, because it loads them asynchronously in the background thread and doesn&#8217;t freeze UI. In this example I will show how to display a loading indicator while the image is loading and an error message if the image loading has failed. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=361&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The built-in Image element is quite good for loading and displaying images from the web, because it loads them asynchronously in the background thread and doesn&#8217;t freeze UI. </p>
<p>In this example I will show how to display a loading indicator while the image is loading and an error message if the image loading has failed. </p>
<div>
<a href="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_loadingview.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_loadingview.png?w=180&#038;h=300" alt="wp7_imageloading_loadingview" width="180" height="300" class="alignleft size-medium wp-image-364" /></a><a href="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_imageview.png"><img src="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_imageview.png?w=180&#038;h=300" alt="wp7_imageloading_imageview" width="180" height="300" class="alignleft size-medium wp-image-363" /></a></p>
<div style="clear:both;"></div>
</div>
<p>You shouldn&#8217;t use the Source property in the XAML markup, instead you should set the Source property in the code-behind.</p>
<p>The XAML markup looks so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;Transparent&quot;&gt;
    &lt;TextBlock x:Name=&quot;loadingView&quot; Visibility=&quot;Collapsed&quot; Text=&quot;Loading...&quot; VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot; /&gt;
    &lt;TextBlock x:Name=&quot;errorView&quot; Visibility=&quot;Collapsed&quot; VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot; /&gt;
    &lt;Image x:Name=&quot;imageView&quot; Visibility=&quot;Collapsed&quot; /&gt;
&lt;/Grid&gt;
</pre>
<p>The code-behind:</p>
<pre class="brush: csharp; title: ; notranslate">
public partial class MainPage : PhoneApplicationPage
{
    public MainPage()
    {
        InitializeComponent();

        var bitmap = new BitmapImage(new Uri(&quot;http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png&quot;));
        bitmap.ImageFailed += (s, e) =&gt; this.ShowError(&quot;Error while loading the image.&quot;);
        bitmap.ImageOpened += (s, e) =&gt; this.ShowImage();

        this.ShowLoading();
        this.imageView.Source = bitmap;
    }

    private void ShowLoading()
    {
        this.loadingView.Visibility = Visibility.Visible;
        this.imageView.Visibility = Visibility.Collapsed;
        this.errorView.Visibility = Visibility.Collapsed;
    }

    private void ShowError(string message)
    {
        this.loadingView.Visibility = Visibility.Collapsed;
        this.imageView.Visibility = Visibility.Collapsed;
        this.errorView.Visibility = Visibility.Visible;

        this.errorView.Text = message;
    }

    private void ShowImage()
    {
        this.loadingView.Visibility = Visibility.Collapsed;
        this.imageView.Visibility = Visibility.Visible;
        this.errorView.Visibility = Visibility.Collapsed;
    }
}
</pre>
<p>At first I create the BitmapImage instance, after the creation of this object I subscribe to its events ImageFailed and ImageOpened. Then I display the loading indicator (the ShowLoading method). And as soon as the line &#8216;this.imageView.Source = bitmap&#8217; is called, the image loading process starts. After some time either ShowError or ShowImage will be called.</p>
<p>The sample application you can download here: <a href="https://dl.dropbox.com/u/8047386/WordPress/PhoneImageLoadingSample.zip" title="Windows Phone image loading sample">https://dl.dropbox.com/u/8047386/WordPress/PhoneImageLoadingSample.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=361&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/04/04/windows-phone-display-images-from-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_loadingview.png?w=180" medium="image">
			<media:title type="html">wp7_imageloading_loadingview</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/04/wp7_imageloading_imageview.png?w=180" medium="image">
			<media:title type="html">wp7_imageloading_imageview</media:title>
		</media:content>
	</item>
		<item>
		<title>My Windows Phone open source application</title>
		<link>http://vortexwolf.wordpress.com/2013/03/15/my-windows-phone-open-source-application/</link>
		<comments>http://vortexwolf.wordpress.com/2013/03/15/my-windows-phone-open-source-application/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 12:21:22 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[ListBox]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=343</guid>
		<description><![CDATA[Though I know Windows Phone development in theory, I haven&#8217;t ever developed applications for this platform. That&#8217;s why I decided to create one application for one web site which provides json api. The site is an imageboard like 4chan, i.e all topics and messages are anonymous and you can attach images to your messages. The [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=343&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Though I know Windows Phone development in theory, I haven&#8217;t ever developed applications for this platform. That&#8217;s why I decided to create one application for one web site which provides json api. The site is an imageboard like 4chan, i.e all topics and messages are anonymous and you can attach images to your messages.</p>
<p>The source code is situated on <a href="https://github.com/vortexwolf?tab=repositories" title="My repositories on github">my github account</a>. I&#8217;ve already created an Android application for this web site and published it on Google Play, so it wasn&#8217;t so difficult to reimplement the application for Windows Phone. It is definitely much easier than to develop it from scratch.</p>
<p>The Windows Phone project is situated <a href="https://github.com/vortexwolf/2ch-Browser-WP7" title="source code of the Windows Phone application">here</a>. </p>
<p>So far the application looks like this:</p>
<p>
<a href="http://vortexwolf.files.wordpress.com/2013/03/wp1.png"><img src="http://vortexwolf.files.wordpress.com/2013/03/wp1.png?w=180&#038;h=300" alt="wp1" width="180" height="300" class="alignleft size-medium wp-image-344" /></a><a href="http://vortexwolf.files.wordpress.com/2013/03/wp2.png"><img src="http://vortexwolf.files.wordpress.com/2013/03/wp2.png?w=180&#038;h=300" alt="wp2" width="180" height="300" class="alignleft size-medium wp-image-345" /></a><a href="http://vortexwolf.files.wordpress.com/2013/03/wp3.png"><img src="http://vortexwolf.files.wordpress.com/2013/03/wp3.png?w=180&#038;h=300" alt="wp3" width="180" height="300" class="alignleft size-medium wp-image-346" /></a></p>
<div style="clear:both;"></div>
</p>
<p>At the moment the application has the following functionality:<br />
1. Downloads and parses JSON files.<br />
2. Displays the loading indicator during loading, displays the error message if an error has occured.<br />
3. Loads and displays list images (thumbnails) asyncronously.<br />
4. Opens full images in the WebBrowser.<br />
5. Converts HTML posts to RichTextBox controls (the parser isn&#8217;t ideal, but it works at least for this website).<br />
6. Makes HTTP POST requests.</p>
<p>By the way, the application is already published in the marketplace and available here: <a href="http://www.windowsphone.com/en-us/store/app/2ch-browser/3f63fa2c-4b35-4b8a-b3c0-51b54b460d70" title="2ch Browser application">http://www.windowsphone.com/en-us/store/app/2ch-browser/3f63fa2c-4b35-4b8a-b3c0-51b54b460d70</a></p>
<p>The certification process was without problems, but I had to wait 5 days.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/343/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=343&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/03/15/my-windows-phone-open-source-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/03/wp1.png?w=180" medium="image">
			<media:title type="html">wp1</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/03/wp2.png?w=180" medium="image">
			<media:title type="html">wp2</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/03/wp3.png?w=180" medium="image">
			<media:title type="html">wp3</media:title>
		</media:content>
	</item>
		<item>
		<title>Displaying progress bar while loading JSON from Web Services for Windows Phone 7</title>
		<link>http://vortexwolf.wordpress.com/2013/02/11/displaying-progress-bar-while-loading-json-from-web-services-for-windows-phone-7/</link>
		<comments>http://vortexwolf.wordpress.com/2013/02/11/displaying-progress-bar-while-loading-json-from-web-services-for-windows-phone-7/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 13:57:28 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=336</guid>
		<description><![CDATA[In one of my previous posts I explained how to download and parse JSON response from web services. I used a simple text to show that the content is loading, but it isn&#8217;t convenient because you don&#8217;t know how long it remains to wait. In this post I will add the ProgressBar control to the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=336&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://vortexwolf.wordpress.com/2012/07/23/working-with-json-web-services-in-silverlight-and-windows-phone-7/">In one of my previous posts</a> I explained how to download and parse JSON response from web services. I used a simple text to show that the content is loading, but it isn&#8217;t convenient because you don&#8217;t know how long it remains to wait. In this post I will add the ProgressBar control to the project which will constantly display the number of downloaded bytes in per cents.<br />
Here is how it looks:<br />
<a href="http://vortexwolf.files.wordpress.com/2013/02/wp7_json_loading.png"><img src="http://vortexwolf.files.wordpress.com/2013/02/wp7_json_loading.png?w=180&#038;h=300" alt="wp7_json_loading" width="180" height="300" class="alignnone size-medium wp-image-337" /></a></p>
<p>At first, I added some code to the XAML view so that it displays the ProgressBar and its description:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;StackPanel Visibility=&quot;{Binding IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}&quot;
            VerticalAlignment=&quot;Center&quot;&gt;
    &lt;TextBlock Text=&quot;{Binding ProgressDescription}&quot; HorizontalAlignment=&quot;Center&quot; Style=&quot;{StaticResource PhoneTextNormalStyle}&quot; /&gt;
    &lt;ProgressBar Value=&quot;{Binding ProgressValue}&quot; Maximum=&quot;1&quot; IsIndeterminate=&quot;False&quot; Height=&quot;50&quot; /&gt;
&lt;/StackPanel&gt;
</pre>
<p>After that I&#8217;ve tried to find some event of the HttpWebRequest class which can report progress, but I haven&#8217;t found it, so I implemented my own ProgressStream class which looks like a common stream but has the OnProgressChanged callback.</p>
<pre class="brush: csharp; title: ; notranslate">
public class ProgressStream : Stream
{
    private readonly Stream _stream;
    private long _length;

    public ProgressStream(Stream stream, long length)
    {
        this._stream = stream;
        this._length = length;
    }

    public override bool CanRead
    {
        get { return this._stream.CanRead; }
    }

    public override bool CanSeek
    {
        get { return this._stream.CanSeek; }
    }

    public override bool CanWrite
    {
        get { return this._stream.CanWrite; }
    }

    public override void Flush()
    {
        this._stream.Flush();
    }

    public override long Length
    {
        get { return this._length; }
    }

    public override long Position
    {
        get
        {
            return this._stream.Position;
        }
        set
        {
            this._stream.Position = value;
        }
    }

    public override int Read(byte[] buffer, int offset, int count)
    {
        int readCount = this._stream.Read(buffer, offset, count);
        this.ReportProgress();

        return readCount;
    }

    public override long Seek(long offset, SeekOrigin origin)
    {
        long seekCount = this._stream.Seek(offset, origin);
        this.ReportProgress();

        return seekCount;
    }

    public override void SetLength(long value)
    {
        this._length = value;
    }

    public override void Write(byte[] buffer, int offset, int count)
    {
        this._stream.Write(buffer, offset, count);
        this.ReportProgress();
    }

    public Action&lt;double&gt; OnProgressChanged { get; set; }

    private void ReportProgress()
    {
        if (this.OnProgressChanged != null)
        {
            var percent = this.Position / (double)this.Length;
            // System.Threading.Thread.Sleep(500); // for test purposes
            this.OnProgressChanged(percent);
        }
    }
}
</pre>
<p>After that I changed the HttpGetTask class so that it uses the new ProgressStream class if it is possible. It is necessary to check the presence of the Content-Length header, because without this header and with unknown length it is impossible to calculate the progress.</p>
<pre class="brush: csharp; title: ; notranslate">
public class HttpGetTask&lt;T&gt;
{
    //...
    
    private void OnGetResponseCompleted(IAsyncResult ar)
    {
        //...
        
        Stream stream;
        if (this.OnProgressChanged != null &amp;&amp; response.Headers.AllKeys.Any(key =&gt; key == &quot;Content-Length&quot;))
        {
            var progressStream = new ProgressStream(response.GetResponseStream(), response.ContentLength);
            progressStream.OnProgressChanged = v =&gt; this.InvokeInUiThread(() =&gt; this.OnProgressChanged(v));
            stream = progressStream;
        }
        else
        {
            stream = response.GetResponseStream();
        }

        //...
    }

    //...
    
    public Action&lt;double&gt; OnProgressChanged { get; set; }
}
</pre>
<p>Then you should update the view model. I added the OnProgressChanged method which updates the ProgressDescription and ProgressValue properties.<br />
Also I changed the url of the sample data, because the website geonames.org which I used earlier doesn&#8217;t send the Content-Length header (it sends the Transfer-Encoding header with value &#8216;chunked&#8217; and unknown length), so I downloaded a JSON response and uploaded it on my dropbox account <a href="https://dl.dropbox.com/u/8047386/WordPress/testcities.json" title="test cities json">here</a>.<br />
The ViewModel looks so:</p>
<pre class="brush: csharp; title: ; notranslate">
public class MainViewModel : INotifyPropertyChanged
{
    public MainViewModel()
    {
        Cities = new ObservableCollection&lt;CityViewModel&gt;();

        string url = &quot;https://dl.dropbox.com/u/8047386/WordPress/testcities.json&quot;;
        
        var task = new HttpGetTask&lt;CitiesList&gt;(url, this.OnPostExecute);
        task.OnPreExecute = this.OnPreExecute;
        task.OnError = this.OnError;
        task.OnProgressChanged = this.OnProgressChanged;

        task.Execute();
    }
    
    //...

    private void OnProgressChanged(double value)
    {
        this.ProgressValue = value;
        this.ProgressDescription = string.Format(&quot;Loading {0:F0}%&quot;, value * 100);
    }

    //...
        
    private double _progressValue;

    public double ProgressValue
    {
        get { return _progressValue; }
        set
        {
            _progressValue = value;
            RaisePropertyChanged(&quot;ProgressValue&quot;);
        }
    }

    private string _progressDescription;

    public string ProgressDescription
    {
        get { return _progressDescription; }
        set
        {
            _progressDescription = value;
            RaisePropertyChanged(&quot;ProgressDescription&quot;);
        }
    }
}
</pre>
<p>Though the loading indicator is difficult to reproduce on the Windows Phone Emulator because it downloads the file very fast, it will be certainly displayed if the phone has a slow internet connection.<br />
I didn&#8217;t add all code to the post, but as usual you can download the full project here:<br />
<a href="https://dl.dropbox.com/u/8047386/WordPress/PhoneJsonProgressBar.zip" title="PhoneJsonProgressBar.zip">PhoneJsonProgressBar.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/336/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/336/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=336&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/02/11/displaying-progress-bar-while-loading-json-from-web-services-for-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/02/wp7_json_loading.png?w=180" medium="image">
			<media:title type="html">wp7_json_loading</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 calendar control</title>
		<link>http://vortexwolf.wordpress.com/2013/01/28/windows-8-calendar-control/</link>
		<comments>http://vortexwolf.wordpress.com/2013/01/28/windows-8-calendar-control/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 07:05:21 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[controls]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=315</guid>
		<description><![CDATA[As far as I see, lot of people search how to add the calendar or datepicker control to their windows 8 applications. Though there is a control which is called WinJS.UI.DatePicker, it is actually not a date picker, it is just 3 comboboxes in one row. But because of the fact that Windows Store apps [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=315&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As far as I see, lot of people search how to add the calendar or datepicker control to their windows 8 applications. Though there is a control which is called <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211681.aspx">WinJS.UI.DatePicker</a>, it is actually not a date picker, it is just 3 comboboxes in one row. But because of the fact that Windows Store apps can be written by using HTML, CSS and Javascript, you can use any HTML controls which was designed for web sites in the internet. <a href="http://www.bitrepository.com/a-collection-of-free-javascript-date-pickers.html" title="21 free date pickers">Here is a link</a> to a short review of 21 free HTML datepickers.</p>
<p>In this post I will show how to use the most popular <a href="http://jqueryui.com/datepicker/" title="jQuery UI Datepicker">JQuery UI Datepicker</a>. You should build your Windows Store app by using Javascript, because for obvious reasons it won&#8217;t work with XAML and C# (though you can try to use <a href="http://winrtxamlcalendar.codeplex.com/" title="WinRT XAML Calendar">this control</a> for C# apps, but I&#8217;m not sure that it will work).<br />
Here is the screenshot of the app running on the simulator:</p>
<p>
<a href="http://vortexwolf.files.wordpress.com/2013/01/win8-calendar.png"><img src="http://vortexwolf.files.wordpress.com/2013/01/win8-calendar.png?w=300&#038;h=168" alt="win8-calendar" width="300" height="168" class="size-medium wp-image-316" /></a>
</p>
<p>At first, it is necessary to download 3 files. Though it is possible for internet web sites to refer to javascript libraries without downloading them, windows store applications can&#8217;t do this, they can use only offline javascript files.<br />
1. <a href="http://code.jquery.com/jquery-1.8.3.js">jQuery 1.8.3</a> (the latest stable version at the moment of writing this post, but you can use any other version)<br />
2. <a href="http://code.jquery.com/ui/1.10.0/jquery-ui.js">jQuery UI</a><br />
3. <a href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">jQuery UI style sheet</a></p>
<p>The first thing that you should do is to modify the jQuery 1.8.3 library. You should add 1 line at the beginning of the file and 1 line at the end:</p>
<pre class="brush: csharp; title: ; notranslate">
MSApp.execUnsafeLocalFunction(function () {
// the original file
});
</pre>
<p>Like this:</p>
<p>
<a href="http://vortexwolf.files.wordpress.com/2013/01/win8-jquery-modified.png"><img src="http://vortexwolf.files.wordpress.com/2013/01/win8-jquery-modified.png?w=300&#038;h=292" alt="win8-jquery-modified" width="300" height="292" class="size-medium wp-image-317" /></a>
</p>
<p>Then add these 3 files to appropriate folders of the project:</p>
<p>
<a href="http://vortexwolf.files.wordpress.com/2013/01/winstore_datepicker_sample_solution_explorer.png"><img src="http://vortexwolf.files.wordpress.com/2013/01/winstore_datepicker_sample_solution_explorer.png?w=291&#038;h=300" alt="winstore_datepicker_sample_solution_explorer" width="291" height="300" class="size-medium wp-image-318" /></a>
</p>
<p>Add links to these files to the head section and add an input element with javascript code to the body section. The whole file looks so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;title&gt;DatePicker Sample&lt;/title&gt;

    &lt;link href=&quot;//Microsoft.WinJS.1.0/css/ui-dark.css&quot; rel=&quot;stylesheet&quot; /&gt;
    &lt;script src=&quot;//Microsoft.WinJS.1.0/js/base.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;//Microsoft.WinJS.1.0/js/ui.js&quot;&gt;&lt;/script&gt;
    
    &lt;script src=&quot;/js/jquery-1.8.3.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/jquery-ui.js&quot;&gt;&lt;/script&gt;
    &lt;link href=&quot;/css/jquery-ui.css&quot; rel=&quot;stylesheet&quot; /&gt;

&lt;!-- These links are not necessary in my application, but they can be useful in other applications --&gt;
&lt;!--&lt;link href=&quot;/css/default.css&quot; rel=&quot;stylesheet&quot; /&gt;
    &lt;script src=&quot;/js/default.js&quot;&gt;&lt;/script&gt;--&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;DatePicker Sample&lt;/h1&gt;
    &lt;p&gt;Date: &lt;input type=&quot;text&quot; id=&quot;datepicker&quot; /&gt;&lt;/p&gt;

    &lt;script type=&quot;text/javascript&quot;&gt;
        $(&quot;#datepicker&quot;).datepicker();
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The source code of the sample application: <a href="https://dl.dropbox.com/u/8047386/WordPress/WinStoreDatepickerSample.zip" title="WinStoreDatepickerSample.zip">WinStoreDatepickerSample.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/315/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=315&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/01/28/windows-8-calendar-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/01/win8-calendar.png?w=300" medium="image">
			<media:title type="html">win8-calendar</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/01/win8-jquery-modified.png?w=300" medium="image">
			<media:title type="html">win8-jquery-modified</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/01/winstore_datepicker_sample_solution_explorer.png?w=291" medium="image">
			<media:title type="html">winstore_datepicker_sample_solution_explorer</media:title>
		</media:content>
	</item>
		<item>
		<title>Silverlight and WP7 chart with data point labels</title>
		<link>http://vortexwolf.wordpress.com/2013/01/01/silverlight-and-wp7-chart-with-data-point-labels/</link>
		<comments>http://vortexwolf.wordpress.com/2013/01/01/silverlight-and-wp7-chart-with-data-point-labels/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 19:44:13 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Chart]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=296</guid>
		<description><![CDATA[Recently I found the question on stackoverflow in which one user asked how to add labels to data points on WPF/Silverlight/Windows Phone Toolkit charts. Whereas almost every javascript chart can do this, this functionality is absent in Silverlight charts and none of developers cares. So I wrote a simple class which extended the LinearSeries class [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=296&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Recently I found <a href="http://stackoverflow.com/questions/13850225/wpf-toolkit-chart-how-to-add-value-label-to-specific-data-point">the question on stackoverflow</a> in which one user asked how to add labels to data points on WPF/Silverlight/Windows Phone Toolkit charts. Whereas almost every javascript chart can do this, this functionality is absent in Silverlight charts and none of developers cares.</p>
<p>So I wrote a simple class which extended the LinearSeries class and now line charts can be displayed like this:</p>
<div>
<a href="http://vortexwolf.wordpress.com/2013/01/01/silverlight-and-wp7-chart-with-data-point-labels/silverlight_chart_datapointlabels/" rel="attachment wp-att-297"><img src="http://vortexwolf.files.wordpress.com/2013/01/silverlight_chart_datapointlabels.png?w=300&#038;h=152" alt="silverlight_chart_datapointlabels" width="300" height="152" class="alignleft size-medium wp-image-297" /></a></p>
<p><a href="http://vortexwolf.wordpress.com/2013/01/01/silverlight-and-wp7-chart-with-data-point-labels/wp7_chart_datapointlabels/" rel="attachment wp-att-298"><img src="http://vortexwolf.files.wordpress.com/2013/01/wp7_chart_datapointlabels.png?w=180&#038;h=300" alt="wp7_chart_datapointlabels" width="180" height="300" class="alignleft size-medium wp-image-298" /></a></p>
<div style="clear:both;"></div>
</div>
<p>I added labels only for line charts, but if someone needs them for column charts, I can try to implement it as well.<br />
In the current implementation I created the class which inherits the LineSeries class. It has the following properties:<br />
<strong>DisplayLabels</strong> &#8211; You should set it to true explicitly so that labels are displayed. It is false by default.<br />
<strong>LabelBindingPath</strong> &#8211; Optional. You can specify a custom property of your model which will be displayed instead of the value from the Y-axis.<br />
<strong>LabelStyle</strong> &#8211; Optional. You can change foreground, font weight, font size and other properties of labels.</p>
<p>The example of usage:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;chart:Chart Width=&quot;600&quot; Height=&quot;300&quot;&gt;
    &lt;local:ExtendedLineSeries
        ItemsSource=&quot;{Binding Items}&quot;
        DependentValuePath=&quot;ItemValue&quot;
        IndependentValuePath=&quot;Title&quot; 
        DisplayLabels=&quot;True&quot;
        LabelBindingPath=&quot;ItemValue&quot; /&gt;
&lt;/chart:Chart&gt;
</pre>
<p>The complete source code of the class:</p>
<pre class="brush: csharp; title: ; notranslate">
public class ExtendedLineSeries : LineSeries
{
    private Canvas _labelsCanvas;
    private Dictionary&lt;DataPoint, TextBlock&gt; _currentLabels = new Dictionary&lt;DataPoint, TextBlock&gt;();

    /// &lt;summary&gt;
    /// Gets or sets a value indicating whether labels should be displayed. 
    /// &lt;/summary&gt;
    public bool DisplayLabels { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the binding path of the label.
    /// &lt;/summary&gt;
    public string LabelBindingPath { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the style of each label.
    /// &lt;/summary&gt;
    public Style LabelStyle { get; set; }

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();

        // get a canvas to which the labels will be added
        this._labelsCanvas = (Canvas)this.GetTemplateChild(&quot;PlotArea&quot;);
        // clear the clip property so that labels are visible even if they exceed the bounds of the chart
        this.Clip = null;
    }

    protected override void UpdateDataPoint(DataPoint dataPoint)
    {
        base.UpdateDataPoint(dataPoint);

        // after the data point is created and added to the chart, we can add a label near it
        if (this.DisplayLabels &amp;&amp; dataPoint.Visibility == System.Windows.Visibility.Visible)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =&gt; this.CreateLabel(dataPoint));
        }
    }

    private void CreateLabel(DataPoint dataPoint)
    {
        // this method is also called with the SizeChanged event, so I create the label only one time
        TextBlock label;
        if (this._currentLabels.ContainsKey(dataPoint))
        {
            label = this._currentLabels[dataPoint];
        }
        else
        {
            label = new TextBlock();
            this._labelsCanvas.Children.Add(label);
            this._currentLabels.Add(dataPoint, label);

            label.Style = this.LabelStyle;

            // bind the label text to the specified path, or to dataPoint.DependantValue by default
            Binding binding = this.LabelBindingPath != null
                        ? new Binding(this.LabelBindingPath) { Source = dataPoint.DataContext }
                        : new Binding(&quot;DependentValue&quot;) { Source = dataPoint };
            BindingOperations.SetBinding(label, TextBlock.TextProperty, binding);
        }

        // calculate a position of the label
        double coordinateY = Canvas.GetTop(dataPoint) - label.ActualHeight; // position the label above the data point
        double coordinateX = Canvas.GetLeft(dataPoint) + dataPoint.ActualHeight / 2 - label.ActualWidth / 2; // center horizontally
        Canvas.SetTop(label, coordinateY);
        Canvas.SetLeft(label, coordinateX);
    }
}
</pre>
<p>In this code I made an override of the UpdateDataPoint method and each time a DataPoint is updated I update its label.<br />
The code work with Silverlight as well as with Windows Phone 7. For WP7 I used the recompiled library which I published in <a href="http://vortexwolf.wordpress.com/2012/09/17/silverlight-toolkit-charts-for-windows-phone-7/" title="Silverlight Toolkit charts for Windows Phone 7">one of my previous posts</a>.</p>
<p>Source code of the sample application: <a href="https://dl.dropbox.com/u/8047386/WordPress/ChartPointLabelsSample.zip" title="ChartPointLabelsSample.zip">ChartPointLabelsSample.zip</a><br />
Show case: <a href="https://dl.dropbox.com/u/8047386/WordPress/SilverlightChart/PointLabels/ChartPointLabelsSampleTestPage.html" title="ChartPointLabelsSampleTestPage.html">ChartPointLabelsSampleTestPage.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=296&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2013/01/01/silverlight-and-wp7-chart-with-data-point-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/01/silverlight_chart_datapointlabels.png?w=300" medium="image">
			<media:title type="html">silverlight_chart_datapointlabels</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2013/01/wp7_chart_datapointlabels.png?w=180" medium="image">
			<media:title type="html">wp7_chart_datapointlabels</media:title>
		</media:content>
	</item>
		<item>
		<title>Just passed 70-480 exam Programming in HTML5 with JavaScript and CSS3</title>
		<link>http://vortexwolf.wordpress.com/2012/12/01/just-passed-70-480-exam-programming-in-html5-with-javascript-and-css3/</link>
		<comments>http://vortexwolf.wordpress.com/2012/12/01/just-passed-70-480-exam-programming-in-html5-with-javascript-and-css3/#comments</comments>
		<pubDate>Sat, 01 Dec 2012 14:56:36 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Microsoft exams]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=289</guid>
		<description><![CDATA[Recently I&#8217;ve found out that it is possible to pass 70-480 exam for free if you have the promo code. The promo code is HTMLJMP and I&#8217;ve found it here: Microsoft virtual academy. Though I post in this blog more about Windows development, I have lot of experience with web development as well, so it&#8217;s [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=289&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Recently I&#8217;ve found out that it is possible to pass <a href="http://www.microsoft.com/learning/en/us/exam.aspx?id=70-480">70-480 exam</a> for free if you have the promo code. The promo code is HTMLJMP and I&#8217;ve found it here: <a href="http://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start">Microsoft virtual academy</a>.</p>
<p>Though I post in this blog more about Windows development, I have lot of experience with web development as well, so it&#8217;s been easy for me to pass this exam.<br />
Before taking this exam, I learned some new features of HTML5:</p>
<ol>
<li>CSS Grid and Flexbox layouts. Yyou don&#8217;t need to use difficult floats and absolute positioning any more, everything is as easy as using StackPanel and Grid controls in XAML.</li>
<li>Javascript web workers which run in a real background thread. But I don&#8217;t know where they can be useful, it is good only for service calls which are already aynchronous and ajax calls don&#8217;t require any background javascript threads.</li>
<li>New HTML tags like &lt;nab&gt;, &lt;aside&gt; and others, which must be useful for search engines, but they don&#8217;t seem to be different from ordinary &lt;div&gt;.</li>
<li>Storage API where you can store data instead of cookies. For example, you can save comments which users type and if they accidentally close the browser and don&#8217;t post anything, you can restore entered text after they visited the site once again, which is very convenient.</li>
</ol>
<p>I will not post examples of questions, because you can find them on the famous free website examcollection. Although they have correct questions, sometimes they have incorrect answers, so you should know the subject, certification of which you are going to pass.</p>
<p>Now I can pass other exams and receive MCSD title.<br />
There are 2 of them related to web development:</p>
<ul>
<li><a href="http://www.microsoft.com/learning/en/us/certification/cert-mcsd-web-applications.aspx">MCSD: Web Applications</a></li>
<li><a href="http://www.microsoft.com/learning/en/us/certification/mcsd-windows-store-apps.aspx">MCSD: Windows Store Apps using HTML5</a></li>
</ul>
<p>And 1 related to Windows development:</p>
<ul>
<li><a href="http://www.microsoft.com/learning/en/us/certification/mcsd-windows-store-apps.aspx">MCSD: Windows Store Apps Using C#</a></li>
</ul>
<p>&nbsp;</p>
<p>As you can see, 2 certifications are almost the same. So what they promised became true: you can develop Windows applications by using HTML and Javascript instead of C# and XAML.<br />
I wouldn&#8217;t say that it is bad, because actually Javascript is an easy language, and it is much easier to perform UI manipulations by using CSS and Javascript instead of XAML. If you tried to design custom controls, you know how horrible XAML is, it is much more inferior in comparison with CSS. On the other hand C# is much better than Javascript.<br />
So I hope that there will be a way to use HTML and C# together while developing Windows store apps, as it is already possible with web sites and ASP.Net MVC.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/289/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=289&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2012/12/01/just-passed-70-480-exam-programming-in-html5-with-javascript-and-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>
	</item>
		<item>
		<title>Highlight found text in ListBox for Silverlight and WP7</title>
		<link>http://vortexwolf.wordpress.com/2012/11/19/highlight-found-text-in-listbox-for-silverlight-and-wp7/</link>
		<comments>http://vortexwolf.wordpress.com/2012/11/19/highlight-found-text-in-listbox-for-silverlight-and-wp7/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 17:06:06 +0000</pubDate>
		<dc:creator>vortexwolf</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[ListBox]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://vortexwolf.wordpress.com/?p=281</guid>
		<description><![CDATA[You probably saw an implementation of search where all matches of the entered query were highlighted in the text or list, or table. Here are 2 screenshots which illustrate the described functionality: It is very easy to implement in Javascript, just 4 lines: But it is slightly more difficult in Silverlight. However the approach is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=281&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>You probably saw an implementation of search where all matches of the entered query were highlighted in the text or list, or table. Here are 2 screenshots which illustrate the described functionality:<br />
<a style="margin-right:20px;" href="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_1.png"><img class="size-medium wp-image-282" title="wp7_list_1" alt="" src="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_1.png?w=180&#038;h=300" height="300" width="180" /></a><a href="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_2.png"><img class="size-medium wp-image-283" title="wp7_list_2" alt="" src="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_2.png?w=180&#038;h=300" height="300" width="180" /></a></p>
<p>It is very easy to implement in Javascript, just 4 lines:</p>
<pre class="brush: jscript; title: ; notranslate">
var html = element.html();
html = html.replace(new RegExp(&quot;&lt;span class=\&quot;highlighted\&quot;&gt;(.*?)&lt;\/span&gt;&quot;, &quot;i&quot;), &quot;$1&quot;); // clear the previous highlight
html = html.replace(new RegExp(&quot;(&quot; + query + &quot;)&quot;, &quot;i&quot;), &quot;&lt;span class=\&quot;highlighted\&quot;&gt;$1&lt;/span&gt;&quot;); // highlight the current search query
element.html(html);
</pre>
<p>But it is slightly more difficult in Silverlight. However the approach is the same:<br />
1. Get the text value.<br />
2. Replace some places in the text by a span with some user-defined style.<br />
3. Parse the result text and display it.</p>
<p>I have created a new project by using the Windows Phone Databound Application template in Visual Studio, so that I don&#8217;t need to create base mark-up and add default data, Visual Studio creates everything by itself.</p>
<p>At first, we need to write methods which replace values of ListBox by formatted values. The corresponding javascript code is `html.replace(new Regexp(&#8230;))`. The C# code looks so:</p>
<pre class="brush: csharp; title: ; notranslate">
public void Search()
{
    this.ClearHighlights();

    if(string.IsNullOrEmpty(SearchQuery))
    {
        return;
    }

    this.AddHighlights();
}

private void ClearHighlights()
{
    var highlightRegex = new Regex(&quot;&lt;Run Foreground='Yellow'&gt;(.*?)&lt;/Run&gt;&quot;);
    foreach (var item in this.Items)
    {
        item.LineOne = highlightRegex.Replace(item.LineOne, &quot;$1&quot;);
        item.LineTwo = highlightRegex.Replace(item.LineTwo, &quot;$1&quot;);
    }
}

private void AddHighlights()
{
    var searchRegex = new Regex(string.Format(&quot;({0})&quot;, this.SearchQuery), RegexOptions.IgnoreCase);
    foreach (var item in this.Items)
    {
        item.LineOne = searchRegex.Replace(item.LineOne, &quot;&lt;Run Foreground='Yellow'&gt;$1&lt;/Run&gt;&quot;);
        item.LineTwo = searchRegex.Replace(item.LineTwo, &quot;&lt;Run Foreground='Yellow'&gt;$1&lt;/Run&gt;&quot;);
    }
}
</pre>
<p>The `LineOne` and `LineTwo` properties contain some strings which are displayed in each item of the ListBox.</p>
<p>Finally, we need to write a binding which correctly displays a text with the `Run` tags. The corresponding javascript code is `elem.html(html)`. I used attached property for this task:</p>
<pre class="brush: csharp; title: ; notranslate">
public static class TextBlockProperties
{
    public static string GetStyledText(DependencyObject obj)
    {
        return (string)obj.GetValue(StyledTextProperty);
    }

    public static void SetStyledText(DependencyObject obj, string value)
    {
        obj.SetValue(StyledTextProperty, value);
    }

    public static readonly DependencyProperty StyledTextProperty =
        DependencyProperty.RegisterAttached(&quot;StyledText&quot;, typeof(string), typeof(TextBlock), new PropertyMetadata(null, StyledText_Changed));


    private static void StyledText_Changed(DependencyObject d, DependencyPropertyChangedEventArgs args)
    {
        var tb = (TextBlock) d;
        var text = (string) args.NewValue;

        if(string.IsNullOrEmpty(text) || !Regex.IsMatch(text, &quot;&lt;Run.*?&gt;.*?&lt;/Run&gt;&quot;))
        {
            tb.Text = text;
            return;
        }

        var formattedTextBlockXaml = &quot;&lt;TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'&gt;&quot; + text + &quot;&lt;/TextBlock&gt;&quot;;
        var formattedTextBlock = (TextBlock) XamlReader.Load(formattedTextBlockXaml);

        // detach parsed inlines from the view tree
        var inlines = formattedTextBlock.Inlines.ToList();
        formattedTextBlock.Inlines.Clear();

        // add inlines to the specified text block
        tb.Inlines.Clear();
        foreach (var inline in inlines)
        {
            tb.Inlines.Add(inline);
        }
    }
}
</pre>
<p>So now all that you need is to use the StyledText property instead of Text:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;TextBlock ext:TextBlockProperties.StyledText=&quot;{Binding LineOne}&quot; /&gt;
</pre>
<p>In my example I used the yellow color for highlighting, but you can change any property of the `Run` class, like FontWeight (Bold), FontStyle (Italic) and others, the list of properties you can find here: <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.run%28v=vs.95%29.aspx" title="Run Class">Run Class</a>.</p>
<p>The sample application which I used in order to make the 2 screenshots above you can download here: <a href="https://dl.dropbox.com/u/8047386/WordPress/Wp7ListSearchSample.zip" title="Wp7ListSearchSample.zip">Wp7ListSearchSample.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vortexwolf.wordpress.com/281/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vortexwolf.wordpress.com/281/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vortexwolf.wordpress.com&#038;blog=21819626&#038;post=281&#038;subd=vortexwolf&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vortexwolf.wordpress.com/2012/11/19/highlight-found-text-in-listbox-for-silverlight-and-wp7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/289a587fcdbac4b49c7aa6e6c7112dbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vortexwolf</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_1.png?w=180" medium="image">
			<media:title type="html">wp7_list_1</media:title>
		</media:content>

		<media:content url="http://vortexwolf.files.wordpress.com/2012/11/wp7_list_2.png?w=180" medium="image">
			<media:title type="html">wp7_list_2</media:title>
		</media:content>
	</item>
	</channel>
</rss>
