<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/2.4.2" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>.NET Nibblets</title>
		<link>http://petterisbetter.com/michael/index.php</link>
		<description></description>
		<language>en-US</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=2.4.2"/>
		<ttl>60</ttl>
				<item>
			<title>Alternating row styles update</title>
			<link>http://petterisbetter.com/michael/index.php/2008/10/17/alternating-row-styles-update</link>
			<pubDate>Fri, 17 Oct 2008 17:57:48 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">WPF</category>			<guid isPermaLink="false">33@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;&lt;b&gt;Framework Update Alert!&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In a &lt;a href=&quot;/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox&quot;&gt;previous post&lt;/a&gt;, I showed a good way to do alternating row styles in a ListBox.&lt;/p&gt;

&lt;p&gt;I recently discovered that .NET 3.5 SP1 adds extended framework support for doing this.&lt;/p&gt;

&lt;p&gt;If you are fortunate enough to be developing with the bleeding edge (3.5 SP1), see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationcount.aspx&quot;&gt;this MSDN page&lt;/a&gt; for an example and documentation of the new framework support.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/10/17/alternating-row-styles-update&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><b>Framework Update Alert!</b></p>

<p>In a <a href="http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox">previous post</a>, I showed a good way to do alternating row styles in a ListBox.</p>

<p>I recently discovered that .NET 3.5 SP1 adds extended framework support for doing this.</p>

<p>If you are fortunate enough to be developing with the bleeding edge (3.5 SP1), see <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationcount.aspx">this MSDN page</a> for an example and documentation of the new framework support.</p><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/10/17/alternating-row-styles-update">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/10/17/alternating-row-styles-update#comments</comments>
		</item>
				<item>
			<title>This is your brain on .NET... any questions?</title>
			<link>http://petterisbetter.com/michael/index.php/2008/10/17/this-is-your-brain-on-net-any-questions</link>
			<pubDate>Fri, 17 Oct 2008 14:55:30 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">News</category>			<guid isPermaLink="false">32@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;I'd just like to take a moment to welcome questions!  Feel free to use my &lt;a href=&quot;http://petterisbetter.com/michael/index.php?disp=msgform&amp;amp;recipient_id=1&amp;amp;redirect_to=http%3A%2F%2Fpetterisbetter.com%2Fmichael%2Findex.php&quot;&gt;contact&lt;/a&gt; page to send me suggestions for articles you'd like to see about C#, WPF or .NET in general.&lt;/p&gt;

&lt;p&gt;Please use the comments form for topical feedback on specific articles.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/10/17/this-is-your-brain-on-net-any-questions&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I'd just like to take a moment to welcome questions!  Feel free to use my <a href="http://petterisbetter.com/michael/index.php?disp=msgform&amp;recipient_id=1&amp;redirect_to=http%3A%2F%2Fpetterisbetter.com%2Fmichael%2Findex.php">contact</a> page to send me suggestions for articles you'd like to see about C#, WPF or .NET in general.</p>

<p>Please use the comments form for topical feedback on specific articles.</p><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/10/17/this-is-your-brain-on-net-any-questions">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/10/17/this-is-your-brain-on-net-any-questions#comments</comments>
		</item>
				<item>
			<title>Alternating row styles in a ListBox</title>
			<link>http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox</link>
			<pubDate>Tue, 14 Oct 2008 18:29:55 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">WPF</category>			<guid isPermaLink="false">31@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;&lt;b&gt;Background&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In WPF, there are often many ways of accomplishing the same end result.  I recommend always looking for the most &quot;correct&quot; solution, and that in my opinion is the one that most naturally fits in with the framework hooks already provided, as well as being the most generic and reusable solution possible.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The Problem&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Simple.  How do I implement alternating row styles in a ListBox?&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Building Blocks&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The following, provided in the framework, will be useful:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemcontainerstyleselector.aspx&quot;&gt;ItemContainerStyleSelector&lt;/a&gt; property of the ItemsControl class&lt;/li&gt;
  &lt;li&gt;The &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.styleselector.aspx&quot;&gt;StyleSelector&lt;/a&gt; base class&lt;/li&gt;
  &lt;li&gt;The static &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemscontrolfromitemcontainer.aspx&quot;&gt;ItemsControlFromItemContainer&lt;/a&gt; method of the ItemsControl class&lt;/li&gt;
  &lt;li&gt;The &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.itemcollection.indexof.aspx&quot;&gt;IndexOf&lt;/a&gt; method of the ItemCollection class&lt;/li&gt;
&lt;/ul&gt;
&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox#more31&quot;&gt;Read more &amp;raquo;&lt;/a&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><b>Background</b></p>

<p>In WPF, there are often many ways of accomplishing the same end result.  I recommend always looking for the most "correct" solution, and that in my opinion is the one that most naturally fits in with the framework hooks already provided, as well as being the most generic and reusable solution possible.</p>

<p><b>The Problem</b></p>

<p>Simple.  How do I implement alternating row styles in a ListBox?</p>

<p><b>Building Blocks</b></p>

<p>The following, provided in the framework, will be useful:</p>

<ul>
  <li>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemcontainerstyleselector.aspx">ItemContainerStyleSelector</a> property of the ItemsControl class</li>
  <li>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.styleselector.aspx">StyleSelector</a> base class</li>
  <li>The static <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemscontrolfromitemcontainer.aspx">ItemsControlFromItemContainer</a> method of the ItemsControl class</li>
  <li>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemcollection.indexof.aspx">IndexOf</a> method of the ItemCollection class</li>
</ul>
<a href="http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox#more31">Read more &raquo;</a><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/10/14/alternating-row-styles-in-a-listbox#comments</comments>
		</item>
				<item>
			<title>PrintTicket provider failed to retrieve PrintCapabilities</title>
			<link>http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-</link>
			<pubDate>Mon, 29 Sep 2008 20:05:41 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">WPF</category>			<guid isPermaLink="false">28@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;&lt;b&gt;More Than Meets the Eye&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;You may have glossed over the following code in my previous post:&lt;/p&gt;

&lt;div class=&quot;csharpcode&quot;&gt;
&lt;pre&gt;        PrintTicket ticket = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; PrintTicket();&lt;/pre&gt;
&lt;pre&gt;        ticket.PageOrientation = PageOrientation.Portrait;&lt;/pre&gt;
&lt;pre&gt;        ticket.CopyCount = copies;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;        PrintCapabilities capabilities = queue.GetPrintCapabilities(ticket);&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;        ...&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;        writer.WriteAsync(documentPaginator, ticket);&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;And I couldn't blame you for it.  On the surface it doesn't appear all that significant or interesting.&lt;/p&gt;

&lt;p&gt;But the reason behind creating and using a custom &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.printing.printticket.aspx&quot;&gt;PrintTicket&lt;/a&gt; goes beyond setting the number of copies for the print job.&lt;/p&gt;

&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-#more28&quot;&gt;Read more &amp;raquo;&lt;/a&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><b>More Than Meets the Eye</b></p>

<p>You may have glossed over the following code in my previous post:</p>

<div class="csharpcode">
<pre>        PrintTicket ticket = <span class="kwrd">new</span> PrintTicket();</pre>
<pre>        ticket.PageOrientation = PageOrientation.Portrait;</pre>
<pre>        ticket.CopyCount = copies;</pre>
<pre>&nbsp;</pre>
<pre>        PrintCapabilities capabilities = queue.GetPrintCapabilities(ticket);</pre>
<pre>&nbsp;</pre>
<pre>        ...</pre>
<pre>&nbsp;</pre>
<pre>        writer.WriteAsync(documentPaginator, ticket);</pre>
</div>

<p>And I couldn't blame you for it.  On the surface it doesn't appear all that significant or interesting.</p>

<p>But the reason behind creating and using a custom <a href="http://msdn.microsoft.com/en-us/library/system.printing.printticket.aspx">PrintTicket</a> goes beyond setting the number of copies for the print job.</p>

<a href="http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-#more28">Read more &raquo;</a><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve-#comments</comments>
		</item>
				<item>
			<title>Background printing with FlowDocumentScrollViewer</title>
			<link>http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr</link>
			<pubDate>Tue, 23 Sep 2008 18:35:56 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">WPF</category>			<guid isPermaLink="false">24@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;&lt;b&gt;Background&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa970909.aspx&quot;&gt;FlowDocument&lt;/a&gt; objects are a great way to present information with flexible layout options.  WPF provides several viewer controls to easily visualize FlowDocument instances in a UI.  One of the big benefits of the viewers is that they format and paginate everything automatically, not only for the display area but also for printing.  This makes it a snap to generate dynamic documents (e.g., receipts in an ordering system), display them on the screen, and print them with correct layout and pagination.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The Problem&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The problem is that the viewer controls (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentreader.aspx&quot;&gt;FlowDocumentReader&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentpageviewer.aspx&quot;&gt;FlowDocumentPageViewer&lt;/a&gt; and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentscrollviewer.aspx&quot;&gt;FlowDocumentScrollViewer&lt;/a&gt;) each offer a single public entry point for printing, such as &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentreader.print.aspx&quot;&gt;Print&lt;/a&gt;, that offers only the default Windows printing behavior.  This means the old ugly Windows Print Dialog pops up.  You cannot automate printing in any way using this approach.&lt;/p&gt;

&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr#more24&quot;&gt;Read more &amp;raquo;&lt;/a&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><b>Background</b></p>

<p><a href="http://msdn.microsoft.com/en-us/library/aa970909.aspx">FlowDocument</a> objects are a great way to present information with flexible layout options.  WPF provides several viewer controls to easily visualize FlowDocument instances in a UI.  One of the big benefits of the viewers is that they format and paginate everything automatically, not only for the display area but also for printing.  This makes it a snap to generate dynamic documents (e.g., receipts in an ordering system), display them on the screen, and print them with correct layout and pagination.</p>

<p><b>The Problem</b></p>

<p>The problem is that the viewer controls (<a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentreader.aspx">FlowDocumentReader</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentpageviewer.aspx">FlowDocumentPageViewer</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentscrollviewer.aspx">FlowDocumentScrollViewer</a>) each offer a single public entry point for printing, such as <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.flowdocumentreader.print.aspx">Print</a>, that offers only the default Windows printing behavior.  This means the old ugly Windows Print Dialog pops up.  You cannot automate printing in any way using this approach.</p>

<a href="http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr#more24">Read more &raquo;</a><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/09/23/background-printing-with-flowdocumentscr#comments</comments>
		</item>
				<item>
			<title>Welcome!</title>
			<link>http://petterisbetter.com/michael/index.php/2008/09/22/welcome</link>
			<pubDate>Mon, 22 Sep 2008 21:55:36 +0000</pubDate>			<dc:creator>Michael Petter</dc:creator>
			<category domain="main">Welcome</category>			<guid isPermaLink="false">23@http://petterisbetter.com/michael/</guid>
						<description>&lt;p&gt;Hello and welcome to .NET Nibblets.  Here you'll find bits of code I've written and nuggets of information I have found to be interesting or helpful in working with C# and the .NET technologies.  Bon appetit!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://petterisbetter.com/michael/index.php/2008/09/22/welcome&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Hello and welcome to .NET Nibblets.  Here you'll find bits of code I've written and nuggets of information I have found to be interesting or helpful in working with C# and the .NET technologies.  Bon appetit!</p><div class="item_footer"><p><small><a href="http://petterisbetter.com/michael/index.php/2008/09/22/welcome">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://petterisbetter.com/michael/index.php/2008/09/22/welcome#comments</comments>
		</item>
			</channel>
</rss>

