<?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>chillijam.co.uk &#187; Mango</title>
	<atom:link href="http://chillijam.co.uk/category/mango/feed/" rel="self" type="application/rss+xml" />
	<link>http://chillijam.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 28 Jan 2021 10:32:11 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>Alter a Pivot controls header template the easy way (WP7)</title>
		<link>http://chillijam.co.uk/2012/01/11/alter-a-pivot-controls-header-template-the-easy-way-wp7/</link>
		<comments>http://chillijam.co.uk/2012/01/11/alter-a-pivot-controls-header-template-the-easy-way-wp7/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 11:01:49 +0000</pubDate>
		<dc:creator><![CDATA[Marc]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[Mango]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=369</guid>
		<description><![CDATA[If you want to alter the template for a Windows Phone 7 pivot control&#8217;s header, the simplest way is as follows&#8230; Of course, all this example does is specifically set the colour used for the title and headers to black, but you can do (almost) whatever you like in those templates. Want to add an &#8230; <a href="http://chillijam.co.uk/2012/01/11/alter-a-pivot-controls-header-template-the-easy-way-wp7/" class="more-link">Continue reading <span class="screen-reader-text">Alter a Pivot controls header template the easy way (WP7)</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If you want to alter the template for a Windows Phone 7 pivot control&#8217;s header, the simplest way is as follows&#8230;</p>
<pre class="brush: csharp; title: ; notranslate">
        &lt;controls:Pivot Title=&quot;Altered Styles&quot;&gt;
            &lt;controls:Pivot.HeaderTemplate&gt;  
                &lt;!-- This changes to look of the items headers --&gt;
                &lt;DataTemplate&gt;
                    &lt;TextBlock Text=&quot;{Binding}&quot; Foreground=&quot;Black&quot;/&gt;
                &lt;/DataTemplate&gt;
            &lt;/controls:Pivot.HeaderTemplate&gt;
            &lt;controls:Pivot.TitleTemplate&gt;
                &lt;!-- This changes to look of the pivot overall title --&gt;
                &lt;DataTemplate&gt;
                    &lt;TextBlock Text=&quot;{Binding}&quot; Foreground=&quot;Black&quot;/&gt;
                &lt;/DataTemplate&gt;
            &lt;/controls:Pivot.TitleTemplate&gt;
            &lt;controls:PivotItem Header=&quot;daily&quot;&gt;
                &lt;Grid/&gt;
            &lt;/controls:PivotItem&gt;
            &lt;controls:PivotItem Header=&quot;hourly&quot;&gt;
                &lt;Grid/&gt;
            &lt;/controls:PivotItem&gt;
        &lt;/controls:Pivot&gt;
</pre>
<p>Of course, all this example does is specifically set the colour used for the title and headers to black, but you can do (almost) whatever you like in those templates.  Want to add an image as a bullet?  Go for it.</p>
<pre class="brush: csharp; title: ; notranslate">
&lt;controls:Pivot.HeaderTemplate&gt;
    &lt;DataTemplate&gt;
        &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
            &lt;Image Height=&quot;48&quot; Width=&quot;48&quot; Source=&quot;/MyBulletImage.png&quot; /&gt;
            &lt;TextBlock Text=&quot;{Binding}&quot; Foreground=&quot;Black&quot;/&gt;
        &lt;/StackPanel&gt;
    &lt;/DataTemplate&gt;
&lt;/controls:Pivot.HeaderTemplate&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2012/01/11/alter-a-pivot-controls-header-template-the-easy-way-wp7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternating ListBox item background colours in WP7</title>
		<link>http://chillijam.co.uk/2012/01/11/alternating-listbox-item-background-colours-in-wp7/</link>
		<comments>http://chillijam.co.uk/2012/01/11/alternating-listbox-item-background-colours-in-wp7/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 10:34:42 +0000</pubDate>
		<dc:creator><![CDATA[Marc]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[Mango]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=364</guid>
		<description><![CDATA[I had a requirement today to implement alternating row colours in a Windows Phone 7 ListBox. After a bit of frustration with searching and only finding answers tht said &#8220;You can&#8217;t do it&#8221;, or that you need to add a property on the model to bind the background to, I eventually hit upon a nugget &#8230; <a href="http://chillijam.co.uk/2012/01/11/alternating-listbox-item-background-colours-in-wp7/" class="more-link">Continue reading <span class="screen-reader-text">Alternating ListBox item background colours in WP7</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I had a requirement today to implement alternating row colours in a Windows Phone 7 ListBox. After a bit of frustration with searching and only finding answers tht said &#8220;You can&#8217;t do it&#8221;, or that you need to add a property on the model to bind the background to, I eventually hit upon a nugget of common sense on <a href="http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/f9e9ce26-d576-45f8-a79d-762176695385" target="_blank">this page</a>.</p>
<p>Basically you need to create a converter class that will handle the alternation of backgrounds for you. It is ridiculously simple once you see it in action.</p>
<p><strong>Step 1 : Create the converter.</strong></p>
<pre class="brush: csharp; title: ; notranslate">
public class AlternateRowColour : IValueConverter
{
bool isAlternate;
SolidColorBrush even = new SolidColorBrush(Colors.Transparent); // Set these two brushes to your alternating background colours.
SolidColorBrush odd = new SolidColorBrush(Color.FromArgb(255, 241, 241, 241));

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
isAlternate = !isAlternate;
return isAlternate ? even : odd ;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
</pre>
<p>Step 2 : Add the converter to the page</p>
<pre class="brush: csharp; title: ; notranslate">
&lt;UserControl
 	...snip...
 	xmlns:conv=&quot;clr-namespace:MyApplication.Converters&quot; 
 	...snip...
 	&gt;
	&lt;UserControl.Resources&gt;
		&lt;conv:AlternateRowColour x:Key=&quot;RowColour&quot; /&gt;
	&lt;/UserControl.Resources&gt;
	...snip...
&lt;/UserControl&gt;
</pre>
<p>Step 3 : Bind to the ListBox</p>
<pre class="brush: csharp; title: ; notranslate">
&lt;ListBox ItemsSource=&quot;{Binding}&quot;&gt;
  &lt;ListBox.ItemTemplate&gt;
    &lt;DataTemplate&gt;
      &lt;Grid Background=&quot;{Binding Converter={StaticResource RowColour}}&quot;&gt;
        &lt;!-- layout XAML --&gt;
      &lt;/Grid&gt;
    &lt;/DataTemplate&gt;
  &lt;/ListBox.ItemTemplate&gt;
&lt;/ListBox&gt;				
</pre>
<p>And you&#8217;re done.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2012/01/11/alternating-listbox-item-background-colours-in-wp7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
