<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Andreas Zenker</title><link>https://weblogs.asp.net:443/andreaszenker/</link><description>a boy named goo</description><item><title>HTTP 301: the zenker has Moved permanently </title><link>https://weblogs.asp.net:443/andreaszenker/http-301-the-zenker-has-moved-permanently</link><description>&lt;p&gt;I have started a new blog recently on my own site. I have enjoyed blogging here and am thankful for the hosting provided by asp.net.&lt;/p&gt;

&lt;p&gt;All my future blogs can be found here:&lt;/p&gt;

&lt;a href='http://www.thezenker.com/blog/'&gt;thezenker.com/blog&lt;/a&gt;

&lt;p&gt;Thanks for reading&lt;/p&gt;</description><pubDate>Thu, 28 Jun 2012 18:01:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/http-301-the-zenker-has-moved-permanently</guid><category>.NET</category><category>ASP.NET</category><category>personal blogging</category></item><item><title>FlowDocument PageWidth, PagePadding and ColumnWidth Oh My!</title><link>https://weblogs.asp.net:443/andreaszenker/flowdocument-pagewidth-pagepadding-and-columnwidth-oh-my</link><description>&lt;p&gt;The ability to create a living, breathing, document right inside a WPF UI is pretty incredible to me. Even after working with it for the last year or so, I am still impressed by the power of this largely forgotten feature of WPF.&lt;/p&gt;  &lt;p&gt;One thing to remember about the FlowDocument model is that &lt;em&gt;this is not your Mama’s WPF&lt;/em&gt;. The FlowDocument objects inherit from FrameworkContentElement, not FrameworkElement as the rest of the WPF control suite does. So, while the document related controls do inherit the goodness of DependencyObject and can support DependencyProperties etc., they miss the features added by UIElement and FrameworkElement which include &lt;em&gt;little&lt;/em&gt; things like Visibility, Height and Width. &lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/frameworkElement_559D2A8B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="frameworkElement" border="0" alt="frameworkElement" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/frameworkElement_thumb_14227832.png" width="545" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/frameworkContentElement_6ACB3033.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="frameworkContentElement" border="0" alt="frameworkContentElement" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/frameworkContentElement_thumb_3B99449C.png" width="539" height="381" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;FlowDocument elements are meant to, well … flow. They fill the available page width, or the width made available by whatever parent they are constrained by such as a TableCell or Paragraph. So, while FrameworkContentElements may support layout specific properties such as Margin and Padding, if you want to get explicit about Width and Height you are either out of luck, going to embed some UIElements in your document (you cad!) or about to write some custom code to make it happen.&lt;/p&gt;  &lt;p&gt;When you insert a FlowDocument into a WPF window you do have some ability to affect the layout of the document as a whole at the top level. So, while a Paragraph does not have a Width or Height property, the FlowDocument does its best to act like a real document and gives you PageWidth, PagePadding and ColumnWidth properties that will affect the overall layout and container size of your document.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;PageWidth&lt;/u&gt;&lt;/strong&gt;: this, as it indicates, is the width of the document page. The amount is set in device independent pixels (a pixel is 1/96 of an inch so 1” = 96 pixels). Keep in mind, when setting this value, that the page margin must also be considered.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;PagePadding&lt;/u&gt;&lt;/strong&gt;: this name, that is much more fitting in WPF then in document land, is actually the page margin. The amount of pixels (1/96 of an inch) between the edge of the paper and the content. So basically, PagePadding + PageWidth should equal, or at least not be greater than, the paper width. If you have 8.5” wide paper (816 pixels) and you have 1/2 margins (48 pixels * 2 = 96) then you only have 720 pixels to play with for PageWidth. PagePadding is of Type Thickness, so you can set a uniform value that applies to all Margins, or set each separately if desired.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;ColumnWidth&lt;/u&gt;&lt;/strong&gt;: This one is not related to the size of the container as much as it is how the content within the container is laid out. As the name indicates, it sets the &lt;em&gt;desired&lt;/em&gt; width of the columns of the document. It is only &lt;em&gt;desired&lt;/em&gt; since, by default, the layout will adjust the ColumnWidth to make best use of the available width of the page. To enforce your column width setting you need to set IsColumnWidthFlexible = False.&lt;/p&gt;  &lt;p&gt;Another gotcha to keep in mind with column width is that the calculation of columns is based on “perceived pressure” of the container. So, just like ScrollBars in normal WPF windows, if you wrap your content in a control that assumes infinite space such as&amp;#160; a ScrollViewer, StackPanel, or FlowDocumentScrollViewer the content inside will feel no need to form up columns since it thinks it has infinity to render itself in.&lt;/p&gt;  &lt;p&gt;The best way to get a feel for how these properties interact and affect each other is to play around with the options and view the results in the UI. To help with that I have included a sample WPF Window that allows you to dynamically change these values and get real time feedback.&lt;/p&gt;  &lt;p&gt;The window xaml:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;FlowPageLayout&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;FlowPageLayout&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;      &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;900&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;TextBox&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Width&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;50&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Margin&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;10,0,15,0&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;DockPanel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Orientation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Horizontal&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;                     &lt;span style="color: #ff0000"&gt;DockPanel&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Dock&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Reader (Paper) Width&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;816&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ReaderWidthText&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;LostFocus&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ReaderWidthText_LostFocus&amp;quot;&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;PageWidth (Pixels)&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;720&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;PageWidthText&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;PagePadding (Pixels)&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;48&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;PagePaddingText&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ColumnWidth (Pixels)&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;100&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ColumnWidthText&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;IsColumnWidthFlexible&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CheckBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;IsChecked&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;FlexibleChecked&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;FlowDocumentReader&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Reader&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;                                 &lt;span style="color: #ff0000"&gt;BorderBrush&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;                                 &lt;span style="color: #ff0000"&gt;BorderThickness&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;                                 &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding ElementName=ReaderWidthText, Path=Text, UpdateSourceTrigger=LostFocus}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;                                 &lt;span style="color: #ff0000"&gt;Margin&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;20&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;FlowDocument&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MainDocument&amp;quot;&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;PageWidth&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding ElementName=PageWidthText, Path=Text}&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;PagePadding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding ElementName=PagePaddingText, Path=Text}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;ColumnWidth&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding ElementName=ColumnWidthText, Path=Text}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;IsColumnWidthFlexible&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding ElementName=FlexibleChecked, Path=IsChecked}&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;FontSize&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;10&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;FontFamily&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Arial&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;                                       &lt;span style="color: #ff0000"&gt;Background&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;                         Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dignissim accumsan purus, ut faucibus turpis ultricies vel. Phasellus quis orci eu massa vulputate placerat. Nunc congue varius lacus in tincidunt. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec ut lorem ante, sed faucibus ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pharetra, mauris vitae mollis congue, tortor libero sollicitudin justo, id posuere arcu arcu sed lorem.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;                         Phasellus molestie dui id lorem cursus luctus. Nulla molestie urna vulputate est sodales sed tempus leo posuere. Suspendisse pharetra, odio et eleifend pulvinar, enim felis faucibus lectus, sit amet consequat turpis magna eget nunc. Aenean eget urna quis justo vestibulum rutrum vel non ligula. Donec blandit dolor quis orci vulputate pulvinar blandit diam dignissim. Nam nec sapien magna. Phasellus faucibus urna eu quam fermentum mollis. Quisque sit amet dolor nulla, eget vehicula nulla.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;                         Nam magna metus, vulputate nec condimentum non, pellentesque in ante. Etiam et enim vel massa semper luctus ac ut quam. Nulla libero nisi, molestie eu lacinia ac, tincidunt non mi. Etiam ornare mi lobortis nunc adipiscing non interdum metus pretium. Morbi felis nulla, dignissim ut blandit vestibulum, euismod ut ipsum. Mauris interdum commodo nisi, vitae pharetra lacus scelerisque eget. Aliquam vel neque nisi. Vivamus consequat scelerisque dignissim. Maecenas lobortis suscipit massa, quis feugiat tortor pulvinar vel. Proin sagittis felis sit amet nunc dignissim semper. Quisque lacinia, tellus sed placerat sagittis, velit justo consectetur est, id aliquam nunc est ac nisl. Curabitur convallis elementum ligula eu ullamcorper.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum52"&gt;  52:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum53"&gt;  53:&lt;/span&gt;                         Suspendisse ac hendrerit enim. Curabitur non lacus sapien, a consequat magna. Mauris tempor, eros ac mollis dapibus, sem lacus facilisis mi, et tristique arcu felis quis ipsum. Nam lobortis, nisl at commodo feugiat, risus enim bibendum odio, quis feugiat libero neque nec quam. Nullam auctor, nibh in sodales adipiscing, tortor odio tristique diam, at molestie lorem eros eget tortor. Cras at velit et lectus malesuada faucibus id sit amet augue. Aliquam rutrum turpis velit. Nunc sit amet faucibus erat.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum54"&gt;  54:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum55"&gt;  55:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum56"&gt;  56:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum57"&gt;  57:&lt;/span&gt;                         Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eu elit a ipsum malesuada imperdiet vitae nec libero. Donec sagittis quam vitae leo consequat id rutrum lacus rutrum. Nullam euismod, velit sit amet porta malesuada, sem libero tempor leo, egestas dignissim diam dolor faucibus massa. Suspendisse vel urna leo, sed vulputate dui. Pellentesque rutrum auctor dolor, blandit lobortis ligula hendrerit eget. In laoreet porttitor mollis. Nam et ligula est. Proin vel nisl quam. Donec posuere, sem a venenatis commodo, lorem massa pulvinar nisi, eget porta quam tellus nec turpis. Donec fringilla tincidunt nibh ut porttitor. Ut lacinia justo nulla. Maecenas ac nisi iaculis metus hendrerit tempus ac vel ante. Aliquam nec erat enim. Aenean turpis turpis, fringilla et auctor id, ullamcorper eget velit. Duis et dui odio, eget tincidunt metus.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum58"&gt;  58:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum59"&gt;  59:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum60"&gt;  60:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum61"&gt;  61:&lt;/span&gt;                         Fusce aliquam nisi nec felis aliquam convallis. Pellentesque laoreet molestie nibh, nec cursus sem tempor eu. Donec sit amet purus orci. Pellentesque vehicula neque nec orci pulvinar elementum. Curabitur massa tellus, imperdiet sit amet rutrum ut, posuere porttitor urna. Aliquam condimentum lobortis felis. In sed feugiat ante. Praesent at diam nibh, sit amet blandit lorem. Nam consequat tellus non arcu porta aliquet. Vivamus orci ante, elementum vitae cursus eget, pulvinar nec mi. Curabitur eu lorem justo. Ut facilisis fringilla metus id tristique.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum62"&gt;  62:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum63"&gt;  63:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum64"&gt;  64:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum65"&gt;  65:&lt;/span&gt;                         Aliquam sed nibh odio, et cursus augue. Aliquam tempor scelerisque eros, tempor scelerisque orci eleifend quis. Nullam vehicula nunc tortor. Donec id suscipit tellus. Etiam venenatis, ipsum vel porttitor porttitor, mi dui consectetur purus, at consequat nunc elit eget elit. Cras nec nibh sit amet ligula ullamcorper imperdiet. Sed hendrerit tempus eleifend. Sed blandit aliquet pretium. Ut porttitor, lacus quis pharetra imperdiet, neque nisl mollis velit, a dapibus erat lectus posuere turpis. In cursus rutrum erat. Nam mauris nisi, posuere quis mollis non, scelerisque ac sem. Phasellus vitae orci velit, id auctor quam.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum66"&gt;  66:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Paragraph&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum67"&gt;  67:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;FlowDocument&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum68"&gt;  68:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum69"&gt;  69:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum70"&gt;  70:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;DockPanel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum71"&gt;  71:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The code behind that resizes the window to stay somewhat in line with the “paper” width&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt; FlowPageLayout&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;Private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; ReaderWidthText_LostFocus(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.&lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Windows.RoutedEventArgs)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Reader &lt;span style="color: #0000ff"&gt;Is&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Exit&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Width = &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Reader.Width + 80&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The window allows changing the key properties in real time to test various combinations of settings. The FlowDocumentReader has a border defined, and a margin as well to help isolate the edge of the “paper” and make the document margin more visible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/flowLayoutWindow_31F0D666.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="flowLayoutWindow" border="0" alt="flowLayoutWindow" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/flowLayoutWindow_thumb_2365B474.png" width="522" height="443" /&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Thu, 12 Jan 2012 04:18:27 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/flowdocument-pagewidth-pagepadding-and-columnwidth-oh-my</guid><category>.NET</category><category>FlowDocument</category><category>VB</category><category>WPF</category></item><item><title>Visual Studio ViEmu and “the Dark Side” all happy together</title><link>https://weblogs.asp.net:443/andreaszenker/visual-studio-viemu-and-the-dark-side-all-happy-together</link><description>&lt;p&gt;So, if you like &lt;a href="http://en.wikipedia.org/wiki/Vi" target="_blank"&gt;vi as an editor&lt;/a&gt; and you use Visual Studio, pony up the money and get &lt;a href="http://www.viemu.com/" target="_blank"&gt;ViEmu&lt;/a&gt;. Best money invested in my productivity and ergonomic efforts of this past year, hands down. If you love to hate your mouse you owe it to yourself to investigate ViEmu. There is also &lt;a href="http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329?SRC=VSIDE" target="_blank"&gt;another free emulator that is available as an extension from the extensions online gallery called VsVim&lt;/a&gt;. However the rest of this blog has to do with configuring ViEmu to work with your particular choice of Visual Studio color scheme.&lt;/p&gt;  &lt;p&gt;First choose a color scheme. I recently moved back to a dark theme &lt;a href="http://studiostyl.es/schemes/son-of-obsidian" target="_blank"&gt;son-of-obsidian&lt;/a&gt;. I usually feel the need to change up the scheme once or twice a year to give my eyes something different to look at. Extra motivation was added in dealing with OpenXml a lot lately and, as a result,parsing and comparing tons of xml files. I found a dark theme in &lt;a href="http://www.vim.org/download.php" target="_blank"&gt;gVim&lt;/a&gt; made the xml a bit easier to digest and I wanted to same experience in Visual Studio.&lt;/p&gt;  &lt;p&gt;Here is a screen shot of Visual Studio with both an xaml and a vb file open.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/darktheme1_17FEA2CD.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="darktheme1" border="0" alt="darktheme1" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/darktheme1_thumb_7CE5D3BE.png" width="585" height="321" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I like the overall theme, but right away I see some issues with usability as highlighted by the numbered arrows.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The line numbers are too dark. Whoever created this theme probably doesn’t have line numbers turned on so it would be easy to miss. &lt;/li&gt;    &lt;li&gt;The flashing, black on black, cursor is almost invisible. &lt;/li&gt;    &lt;li&gt;The default ViEmu search highlight color, yellow, stands out nicely but depending on what content is highlighted, the foreground color may not have enough contrast to be readable. The highlights in the right file fall in string literals and the Orange font comes thru well enough, but in the left file, the White foreground Method name combines with the Yellow to create a retina-searing glare. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Good news is that fixing all of these issues is fairly straightforward and also is a good exercise in learning how to configure the hybrid vim/Visual Studio environment.&lt;/p&gt;  &lt;h3&gt;Line numbers:&lt;/h3&gt;  &lt;p&gt;Fixing the line number foreground color turns out to be the easiest of the bunch, as it is just a setting in the Visual Studio Options. Go to Tools &amp;gt;&amp;gt; Options &amp;gt;&amp;gt; Fonts and Colors and look for the Line Numbers item under the Text Editor settings. Pick a custom color that makes you feel better about your line numbers.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/linenumbers_527A8E77.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="linenumbers" border="0" alt="linenumbers" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/linenumbers_thumb_6476AC37.png" width="547" height="441" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Setting the cursor color.&lt;/h3&gt;  &lt;p&gt;This one is a bit more work. Visual Studio does not expose a setting to change this color. However, vim has options that can be set to change these colors. Vim is configured, in the real vim, using the .vimrc (or _vimrc) file in the program path. ViEmu has its own version of the file called viemurc. The biggest challenge you will face is figuring out just where this file should be created in order for ViEmu to find it when it loads up.&lt;/p&gt;  &lt;p&gt;The ViEmu support says to simply save the file to the folder indicated by your HOMEDRIVE Or HOMEPATH environment variables. So, just where, exactly, are they? Well on my Windows 7 machine that equates to “C:\” and “Users\Andreas” respectively. However in my work environment one, or both, of these variables are set to network share paths. To find out for sure what folders are HOME for you, open up a CMD prompt and run the “set” command. This will list the current state of all environment variables.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/setcommand_12344F30.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="setcommand" border="0" alt="setcommand" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/setcommand_thumb_310AC30E.png" width="549" height="279" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now that you know &lt;em&gt;where&lt;/em&gt;, create the &lt;em&gt;what&lt;/em&gt;. Create a file called viemurc, no extension. Once it is created you can add the following lines that will configure the cursor colors.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; highlight Cursor guifg=white guibg=black&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; highlight iCursor guifg=white guibg=steelblue&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; set guicursor=n-v-c:block-Cursor&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; set guicursor+=i:ver100-iCursor&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; set guicursor+=n-v-c:blinkon0&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; set guicursor+=i:blinkwait10&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Ok, so that takes care of line numbers and cursors, now for the last item:&lt;/p&gt;

&lt;h3&gt;Vim search highlights:&lt;/h3&gt;

&lt;p&gt;The interesting thing about this one is that it looks easy at first but doesn’t seem to work. The same options screen we used for the line numbers above also has some ViEmu specific options, all prefixed with ViEmu (go figure). The HL Search Adornment and HL Search Font are what we are looking for. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/viemuHLSetting_55BBDA85.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="viemuHLSetting" border="0" alt="viemuHLSetting" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/viemuHLSetting_thumb_2D3CF871.png" width="553" height="320" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, when you update these you will see the background change, but not the foreground. What gives? Seems that ViEmu respectfully defaults to not altering the Visual Studio configured foreground for search highlights and instead just paints an adorner behind the pattern text with the selected background color. That may work for you. If not, you need to turn this “polite” feature off in the ViEmu settings. Under the ViEmu menu in Studio, make sure the “use adornments” checkbox is unchecked and click Ok.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/useAdornments_31D3032B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="useAdornments" border="0" alt="useAdornments" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/useAdornments_thumb_575C808C.png" width="369" height="406" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it, now the background and foreground you set for vim searches will be honored. &lt;/p&gt;

&lt;p&gt;So, just a few minutes to make peace between ViEmu and a dark Visual Studio Theme.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/newcolors_555EE187.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="newcolors" border="0" alt="newcolors" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/newcolors_thumb_6150ABEE.png" width="563" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.ngedit.com/viemu_doc.html" target="_blank"&gt;ViEmu documentation that includes how to set up viemurc file options&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stackoverflow.com/questions/6230490/how-i-can-change-cursor-color-in-color-scheme-vim" target="_blank"&gt;Stack Overflow question that shows how to change cursor colors&lt;/a&gt;&lt;/p&gt;

&lt;p align="center"&gt;&lt;font size="1"&gt;Posted on &lt;/font&gt;&lt;a href="http://weblogs.asp.net/"&gt;&lt;font size="1"&gt;ASP.NET Weblogs&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt; © Copyright 2011 - &lt;/font&gt;&lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx"&gt;&lt;font size="1"&gt;Andreas Zenker&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 16 Dec 2011 01:36:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/visual-studio-viemu-and-the-dark-side-all-happy-together</guid><category>.NET</category><category>viemu</category><category>vim</category><category>Visual Studio</category></item><item><title>iOS5 email may need to be redefined</title><link>https://weblogs.asp.net:443/andreaszenker/ios5-email-may-need-to-be-redefined</link><description>&lt;p&gt;Got my iOs5 update yesterday, mostly cool. However I was unable to send from my Verizon account, kept getting errors like “server does not allow relaying” when I tried to send or reply to mail. I was able to download new mail no problem. &lt;/p&gt;  &lt;p&gt;I tried changing authentication settings to no avail. Based on a forum post from the iOs4 upgrade, I deleted the account and set it up from scratch and all was good. &lt;/p&gt;  &lt;p&gt;Besides that the upgrade went pretty smooth, still I have to say all the “sell your soul to the iCloud” settings make me feel like I just gave my privacy away but that is another story.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;Posted on &lt;a href="http://weblogs.asp.net/"&gt;ASP.NET Weblogs&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; © Copyright 2011 - &lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx"&gt;Andreas Zenker&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 14 Oct 2011 23:07:41 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/ios5-email-may-need-to-be-redefined</guid><category>iOS mobile</category></item><item><title>Friends Don't Let Friends Use VS Merge Tool</title><link>https://weblogs.asp.net:443/andreaszenker/friends-don-t-let-friends-use-vs-merge-tool</link><description>&lt;p&gt;There are many things that Visual Studio does so well out-of-the-box, and then there is merging conflicts. The built-in merge tool is about as helpful as high beams on your car on a foggy night. The screen is full of information you just can't tell what it means.&lt;/p&gt;&lt;p&gt;Other merge tools, such as &lt;a href="http://winmerge.org/"&gt;WinMerge&lt;/a&gt; will make your manual merge experience much more pleasurable and cut down on bad decisions brought about by information obfuscation. Fortunately you can change the defaut merge tool in Visual Studio. The blog entry that I have been using as my guide in this lately is this good write-up &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://blog.paulbouwer.com/2010/01/31/replace-diffmerge-tool-in-visual-studio-team-system-with-winmerge/"&gt;Replace diff/merge tool in Visual Studio Team System with WinMerge | paulbouwer.com&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Quote from his blog:&lt;/strong&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;One thing I cannot get used to is the basic diff/merge tool.  Where is the detail ?  The screenshot below demonstrates the basic nature of the diff tool built into Visual Studio Team System. There is no indication of the number of differences between the files being diff&amp;rsquo;ed or even the actual differences on a particular line &amp;hellip;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="text-align: center;"&gt;Posted on&amp;nbsp;&lt;a href="http://weblogs.asp.net/"&gt;ASP.NET Weblogs&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;copy; Copyright 2011 -&amp;nbsp;&lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx"&gt;Andreas Zenker&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 16 Sep 2011 20:05:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/friends-don-t-let-friends-use-vs-merge-tool</guid><category>.NET</category><category>Visual Studio</category></item><item><title>Make your head hurt in a good way</title><link>https://weblogs.asp.net:443/andreaszenker/make-your-head-hurt-in-a-good-way</link><description>&lt;p&gt;&lt;font size="2"&gt;I have been just as attentive to blog reading as I have to blog writing and was enjoying some extra-long fix/compile/test cycles today and was able to catch up on Eric Lippert’s blog. All I have to say is: “my head hurts … and it feels great!”.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;So much of the content today is “fluffy” for lack of better word. Maybe you have been the victim of the YACPC? (Yet Another Cloud Podcast) &lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;Have you heard? the cloud is wonderful, in the cloud small children never cry, there are no taxes and your cell phone bill makes sense. Everyone, go to the cloud, go to the cloud …. But I digress.&lt;/em&gt; &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;font size="2"&gt;So, amidst all the fluffiness it is nice to have some clever, and even meaningful, content well delivered. If you haven’t been exposed yet I suggest you start with two recent posts:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx" href="http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx" target="_blank"&gt;The Truth About Value Types&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/ericlippert/archive/2010/09/16/is-is-as-or-is-as-is.aspx" target="_blank"&gt;Is Is As Or Is As Is&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;font size="1"&gt;Posted on &lt;/font&gt;&lt;a href="http://weblogs.asp.net/" mce_href="http://weblogs.asp.net/"&gt;&lt;font size="1"&gt;ASP.NET Weblogs&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; © Copyright 2009 - &lt;/font&gt;&lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx" mce_href="http://weblogs.asp.net/andreaszenker/default.aspx"&gt;&lt;font size="1"&gt;Andreas Zenker&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 01 Oct 2010 01:10:24 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/make-your-head-hurt-in-a-good-way</guid><category>.NET</category><category>Architecture</category><category>Visual Studio</category></item><item><title>Custom Filter for a WPF TextBox</title><link>https://weblogs.asp.net:443/andreaszenker/custom-filter-for-a-wpf-textbox</link><description>&lt;P&gt;So, I had a need to implement a TextBox in WPF with auto filtering functionality. For example the initial requests were to limit a TextBox to numeric characters only. This was simple enough. Handle the PreviewTextInput Event and only allow numeric characters to be entered. So my first, simplistic, hack version was simply this:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;'handle numeric only textboxes&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt; TextBox_PreviewTextInput(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; sender &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Object&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; e &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; System.Windows.Input.TextCompositionEventArgs) &lt;SPAN style="COLOR: #0000ff"&gt;Handles&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Me&lt;/SPAN&gt;.PreviewTextInput&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; NumericValuesOnly &lt;SPAN style="COLOR: #0000ff"&gt;AndAlso&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; IsNumeric(e.Text) &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;        e.Handled = &lt;SPAN style="COLOR: #0000ff"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, the next request was for a non-numeric TextBox that allowed any character except numerical. So, I could just invert the logic I have shown above. Or, based on a good recommendation from a fellow developer, I could take a few minutes and make the filtering functionality “real” by having a Regular Expression being used for all filtering under the hood and then allow custom Regular Expressions to support those “one-off” situations that will inevitably come up.&lt;/P&gt;
&lt;P&gt;So, I added some properties and fields to support the new functionality. A CustomTextFilterRegexPattern String to allow custom filtering. A mode flag to allow the RegEx to function as an “Allow” filter or a “Deny” filter. &lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; mTextFilteringRegEx &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; Regex&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Shared&lt;/SPAN&gt; sNumericRegex &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;New&lt;/SPAN&gt; Regex(&lt;SPAN style="COLOR: #006080"&gt;"[0-9]"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; mCustomTextFilterRegexExpression &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt; CustomTextFilterRegexExpression() &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum7&gt;   7:&lt;/SPAN&gt;       &lt;SPAN style="COLOR: #0000ff"&gt;Return&lt;/SPAN&gt; mCustomTextFilterRegexExpression&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum8&gt;   8:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum9&gt;   9:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; value &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum10&gt;  10:&lt;/SPAN&gt;       mCustomTextFilterRegexExpression = value&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum11&gt;  11:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum12&gt;  12:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum13&gt;  13:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum14&gt;  14:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; mIsFilterInAllowMode &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum15&gt;  15:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt; IsFilterInAllowMode() &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum16&gt;  16:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum17&gt;  17:&lt;/SPAN&gt;       &lt;SPAN style="COLOR: #0000ff"&gt;Return&lt;/SPAN&gt; mIsFilterInAllowMode&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum18&gt;  18:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum19&gt;  19:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; value &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum20&gt;  20:&lt;/SPAN&gt;       mIsFilterInAllowMode = value&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum21&gt;  21:&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum22&gt;  22:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; Property&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Then I added two properties to make defining built-in filters easier.&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; mNumericValuesOnly &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt; NumericValuesOnly() &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;Return&lt;/SPAN&gt; mNumericValuesOnly&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; Value &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum7&gt;   7:&lt;/SPAN&gt;         mNumericValuesOnly = Value&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum8&gt;   8:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum9&gt;   9:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum10&gt;  10:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum11&gt;  11:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; mNonNumericValuesOnly &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum12&gt;  12:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Property&lt;/SPAN&gt; NonNumericValuesOnly() &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum13&gt;  13:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum14&gt;  14:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;Return&lt;/SPAN&gt; mNonNumericValuesOnly&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum15&gt;  15:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Get&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum16&gt;  16:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; value &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum17&gt;  17:&lt;/SPAN&gt;         mNonNumericValuesOnly = value&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum18&gt;  18:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Set&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum19&gt;  19:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; Property&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Now in the Initialized Handler I wire up to the Paste Command and also set up my internal Regex to match what options have been defined in the XAML.&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt; Textbox_Initialized(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; sender &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Object&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; e &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; System.EventArgs) &lt;SPAN style="COLOR: #0000ff"&gt;Handles&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Me&lt;/SPAN&gt;.Initialized&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Dim&lt;/SPAN&gt; pasteBinding &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;New&lt;/SPAN&gt; CommandBinding(ApplicationCommands.Paste, _&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;New&lt;/SPAN&gt; ExecutedRoutedEventHandler(&lt;SPAN style="COLOR: #0000ff"&gt;AddressOf&lt;/SPAN&gt; OnPasteCommandExecute))&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Me&lt;/SPAN&gt;.CommandBindings.Add(pasteBinding)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #008000"&gt;'todo - add check to enforce mutually exclusive settings&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum7&gt;   7:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum8&gt;   8:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; NumericValuesOnly &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum9&gt;   9:&lt;/SPAN&gt;         mTextFilteringRegEx = sNumericRegex&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum10&gt;  10:&lt;/SPAN&gt;         IsFilterInAllowMode = &lt;SPAN style="COLOR: #0000ff"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum11&gt;  11:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum12&gt;  12:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum13&gt;  13:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; NonNumericValuesOnly &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum14&gt;  14:&lt;/SPAN&gt;         mTextFilteringRegEx = sNumericRegex&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum15&gt;  15:&lt;/SPAN&gt;         IsFilterInAllowMode = &lt;SPAN style="COLOR: #0000ff"&gt;False&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum16&gt;  16:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum17&gt;  17:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum18&gt;  18:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;.IsNullOrEmpty(CustomTextFilterRegexExpression) &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum19&gt;  19:&lt;/SPAN&gt;         mTextFilteringRegEx = &lt;SPAN style="COLOR: #0000ff"&gt;New&lt;/SPAN&gt; Regex(CustomTextFilterRegexExpression)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum20&gt;  20:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum21&gt;  21:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; Sub&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;All that is left now is to handle PreviewTextInput and the Paste Command Execute Handler. &lt;/P&gt;
&lt;P&gt;It was easy enough to deny characters in the PreviewTextInput, if the new value did not match the current filter setting then cancel the event by marking it Handled.&lt;/P&gt;
&lt;P&gt;For the paste command, however, I needed to process an entire string. The negative filter was easy, any match of a “deny” filter would cancel the paste command. For the positive filter, how could I easily screen a string of unknown length for any characters that did not match the filter Regex. Since the filter was a character filter, would I need to loop thru the entire string and check each value? Then I realized that using the Regex to do a Replace() and set the replace string to String.Empty() would only leave a non-empty string as the result if there were invalid characters in the string. &lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt; OnPasteCommandExecute(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; sender &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Object&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; e &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; ExecutedRoutedEventArgs)&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;Dim&lt;/SPAN&gt; toExecutePaste &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN style="COLOR: #0000ff"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; mCustomTextFilterRegexExpression &lt;SPAN style="COLOR: #0000ff"&gt;Is&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Nothing&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;Dim&lt;/SPAN&gt; pasteText &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt; = Clipboard.GetText()&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum5&gt;   5:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; IsFilterInAllowMode &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum6&gt;   6:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #008000"&gt;'try a replace, if any characters survive the replace then the string is invalid&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum7&gt;   7:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;.IsNullOrEmpty(mTextFilteringRegEx.Replace(pasteText, &lt;SPAN style="COLOR: #0000ff"&gt;String&lt;/SPAN&gt;.Empty)) &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum8&gt;   8:&lt;/SPAN&gt;                 toExecutePaste = &lt;SPAN style="COLOR: #0000ff"&gt;False&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum9&gt;   9:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum10&gt;  10:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;Else&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum11&gt;  11:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #008000"&gt;'any match on the deny mode filter equals a cancel of the paste&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum12&gt;  12:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; mTextFilteringRegEx.IsMatch(pasteText) &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum13&gt;  13:&lt;/SPAN&gt;                 toExecutePaste = &lt;SPAN style="COLOR: #0000ff"&gt;False&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum14&gt;  14:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum15&gt;  15:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum16&gt;  16:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum17&gt;  17:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum18&gt;  18:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum19&gt;  19:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; toExecutePaste &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Me&lt;/SPAN&gt;.Paste()    &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum20&gt;  20:&lt;/SPAN&gt;     e.Handled = &lt;SPAN style="COLOR: #0000ff"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum21&gt;  21:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum22&gt;  22:&lt;/SPAN&gt;&amp;nbsp; &lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum23&gt;  23:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt; Textbox_PreviewTextInput(&lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; sender &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Object&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #0000ff"&gt;ByVal&lt;/SPAN&gt; e &lt;SPAN style="COLOR: #0000ff"&gt;As&lt;/SPAN&gt; System.Windows.Input.TextCompositionEventArgs) &lt;SPAN style="COLOR: #0000ff"&gt;Handles&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Me&lt;/SPAN&gt;.PreviewTextInput&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum24&gt;  24:&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #008000"&gt;'If filtering is applied and we fail the regex then cancel event&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum25&gt;  25:&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; mTextFilteringRegEx &lt;SPAN style="COLOR: #0000ff"&gt;Is&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Nothing&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum26&gt;  26:&lt;/SPAN&gt;        &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt; mTextFilteringRegEx.IsMatch(e.Text) = &lt;SPAN style="COLOR: #0000ff"&gt;Not&lt;/SPAN&gt; IsFilterInAllowMode &lt;SPAN style="COLOR: #0000ff"&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum27&gt;  27:&lt;/SPAN&gt;            e.Handled = &lt;SPAN style="COLOR: #0000ff"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum28&gt;  28:&lt;/SPAN&gt;        &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum29&gt;  29:&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum30&gt;  30:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So now I can implement a TextBox with custom filtering like this:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;
&lt;DIV style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum1&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;myFramework:CustomTextBox&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #ff0000"&gt;UIProperty&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="{Binding Path=IntegerValueUIProperty}"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum2&gt;   2:&lt;/SPAN&gt;                                     &lt;SPAN style="COLOR: #ff0000"&gt;CustomTextFilterRegexExpression&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="[4,5,6,x,y]"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum3&gt;   3:&lt;/SPAN&gt;                                     &lt;SPAN style="COLOR: #ff0000"&gt;IsFilterInAllowMode&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="True"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;SPAN style="COLOR: #606060" id=lnum4&gt;   4:&lt;/SPAN&gt;                                              &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!--CRLF--&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description><pubDate>Thu, 03 Jun 2010 01:36:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/custom-filter-for-a-wpf-textbox</guid><category>.NET</category><category>VB</category><category>Visual Studio</category><category>WPF</category></item><item><title>Better than Contains()</title><link>https://weblogs.asp.net:443/andreaszenker/better-than-contains</link><description>&lt;P&gt;Sometimes you wish you could do better than the method you need to use. Case in point: Contains(). It is a fine method and is meant for more than strings. If you need custom logic to decide if two objects are equal or “the same” for the sake of sorting or searching you write your own comparer and pass that in. So, I don’t have anything against the Contains() method for any reason, I only find it a bit too generic when all I have is a list of strings and want to see if I have a match that doesn’t care about case.&lt;/P&gt;
&lt;P&gt;I figured LINQ might be a good fit. So I whipped up a simple* LINQ expression. I was able to do a select using a String.Compare() call, then I could pass in the ignoreCase parameter to get my desired results.&lt;/P&gt;&lt;PRE class=csharpcode&gt;     &lt;SPAN class=kwrd&gt;Private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt; CheckIfAllowed(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; myTargetPath &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;)
        &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; allowedPageList &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; List(Of &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;)
        allowedPageList.Add(&lt;SPAN class=str&gt;"Logoff.aspx"&lt;/SPAN&gt;)
        allowedPageList.Add(&lt;SPAN class=str&gt;"AccessDenied.aspx"&lt;/SPAN&gt;)
        allowedPageList.Add(&lt;SPAN class=str&gt;"Login.aspx"&lt;/SPAN&gt;)

        &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; found = From p &lt;SPAN class=kwrd&gt;In&lt;/SPAN&gt; allowedPageList Where &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;.Compare(myTargetPath, p, ignoreCase:=&lt;SPAN class=kwrd&gt;True&lt;/SPAN&gt;) = 0
        &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; found.Count &amp;gt; 0 &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
            MessageBox.Show(&lt;SPAN class=str&gt;"Found"&lt;/SPAN&gt;)
        &lt;SPAN class=kwrd&gt;Else&lt;/SPAN&gt;
            MessageBox.Show(&lt;SPAN class=str&gt;"Not Found"&lt;/SPAN&gt;)
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; Sub&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;So, that was pretty cool. The next logical step seemed to be to create an extension for the List(Of String) class.&lt;/P&gt;&lt;PRE class=csharpcode&gt;     &lt;SPAN class=rem&gt;''' &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' Searches the List(Of String) using case-insensitive LINQ query&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' &amp;lt;param name="list"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' &amp;lt;param name="value"&amp;gt;the string to search for&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' &amp;lt;returns&amp;gt;true if item is found. default: false&amp;lt;/returns&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/SPAN&gt;
        &amp;lt;Extension()&amp;gt; _
        &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Function&lt;/SPAN&gt; ContainsIgnoreCase(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; list &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; List(Of &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;), &lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; value &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Boolean&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; found = From p &lt;SPAN class=kwrd&gt;In&lt;/SPAN&gt; list Where &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;.Compare(value, p, ignoreCase:=&lt;SPAN class=kwrd&gt;True&lt;/SPAN&gt;) = 0
            &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; found.count &amp;gt; 0
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; Function&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;So I can have this “new function” available on all List(Of String) instances.&lt;/P&gt;&lt;PRE class=csharpcode&gt;  &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; allowedPageList.ContainsIgnoreCase(myTargetPath) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
         MessageBox.Show(&lt;SPAN class=str&gt;"Found"&lt;/SPAN&gt;)
  &lt;SPAN class=kwrd&gt;Else&lt;/SPAN&gt;
         MessageBox.Show(&lt;SPAN class=str&gt;"Not Found"&lt;/SPAN&gt;)
  &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; If&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;After I created my extension I thought: “I probably just duplicated something that was already part of a special collection type” so I looked thru the collection types and, under the &lt;EM&gt;Specialized &lt;/EM&gt;namespace I found the class &lt;EM&gt;StringCollection&lt;/EM&gt;. This exposes a Contains() method as well. However, even though it is a string specific collection the documentation indicates:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;“This method determines equality by calling &lt;/EM&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.object.equals.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.object.equals.aspx"&gt;&lt;EM&gt;Object.Equals&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;. String comparisons are case-sensitive.”&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;*I still can’t write one without Googling for samples. Learning more about the syntax is always on my to do list.&lt;/EM&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;FONT size=1&gt;Posted on &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/" mce_href="http://weblogs.asp.net/"&gt;&lt;FONT size=1&gt;ASP.NET Weblogs&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; © Copyright 2009 - &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/andreaszenker/default.aspx" mce_href="http://weblogs.asp.net/andreaszenker/default.aspx"&gt;&lt;FONT size=1&gt;Andreas Zenker&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;</description><pubDate>Thu, 03 Dec 2009 01:13:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/better-than-contains</guid><category>ASP.NET</category><category>LINQ</category><category>VB</category></item><item><title>Taming the SharePoint Wiki</title><link>https://weblogs.asp.net:443/andreaszenker/taming-the-sharepoint-wiki</link><description>&lt;p&gt;Our current project team decided to post development documents, guidelines, specs etc in a SharePoint site dedicated to project. We also decided we would try a Wiki to post coding standards and best practices, samples, tips on using certain WPF controls etc. &lt;/p&gt;  &lt;p&gt;So, SharePoint Wiki is really convenient to set up. Add a new site, choose the Wiki template and you are off an running. That is until you decide you are going to try to add some serious amount of content. The built in editor is good for only simple pages and the image upload feature is … well … &lt;em&gt;less than perfect &lt;/em&gt;shall we say. After attempting to upload my first image 3 times with no success, I started looking for other options. In my search I found a &lt;a href="http://stackoverflow.com/questions/11462/sharepoint-wikis"&gt;question on StackOverflow&lt;/a&gt; that led to a great work-around for me. Not sure if this has been posted elsewhere but I felt it was worth a shout-out. &lt;/p&gt;  &lt;p&gt;In answer to a question about potential reasons to &lt;em&gt;not&lt;/em&gt; use SP Wikis, &lt;a href="http://stackoverflow.com/users/16846/jfaughnan"&gt;jfaughnan&lt;/a&gt; posted an answer that included his approach to getting around the lousy editor experience in the Wiki:&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;“There is a convoluted workaround that I use. It takes advantage of the superb SharePoint support and image editing integrated with Windows Live Writer.&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font color="#004080"&gt;Create a SP blog that will hold the images that will be referenced in the wiki. &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#004080"&gt;Use Windows Live Writer to post to the wiki-image-blog. Drop your image into WLW, resize it as needed, etc. If you like, use WLW to write your image associated wiki text first draft as well. &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#004080"&gt;After you post to the Wiki, copy and paste image and text into the Wiki editor rich text field.&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font color="#004080"&gt;This takes surprisingly little time, far less than any other option I've read of. I admit, it is convoluted.”&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The author calls it “convoluted”, actually I found it to be a sheer stroke of genius. 15 minutes later I had my “staging blog” set up as a new site, had LiveWriter configured to post to the blog and was up and running with a nice editor, formatting for code samples and cut-and-paste and resize for pictures. LiveWriter handles uploading the images to the blog site. Once your new Wiki content is posted, open the post to edit in the blog site, copy the raw contents and paste them, images and all, into a new Wiki page. Tweak a few links and you are good to go.&lt;/p&gt;  &lt;p align="center"&gt;&lt;font size="1"&gt;Posted on &lt;/font&gt;&lt;a href="http://weblogs.asp.net/"&gt;&lt;font size="1"&gt;ASP.NET Weblogs&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; © Copyright 2009 - &lt;/font&gt;&lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx" target="_blank"&gt;&lt;font size="1"&gt;Andreas Zenker&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Wed, 14 Oct 2009 02:23:42 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/taming-the-sharepoint-wiki</guid><category>.NET</category><category>SharePoint</category><category>Writing</category></item><item><title>Is My Blog Worth Stealing?</title><link>https://weblogs.asp.net:443/andreaszenker/is-my-blog-worth-stealing</link><description>&lt;p&gt;Apparently to some, it is. &lt;/p&gt;  &lt;p&gt;I was helping a co-worker with the same issue that I blogged about in &lt;a href="http://weblogs.asp.net/andreaszenker/archive/2009/09/07/sharepoint-list-item-delete-vs-deleteitembyid.aspx" target="_blank"&gt;my last post on how to improve SharePoint list item delete calls&lt;/a&gt;. When I Googled (Binged if that makes you feel better) on the subject trying to find a clear answer to her question I found another blogger who had written on the same subject. Cool! Maybe he has the missing piece. I opened the link to find … my own post. There it was, in its entirety. With no clear attribution as to its original source. There &lt;em&gt;was&lt;/em&gt; a link on the page back to my site, but why would anyone click it since the entire post was there for their reading pleasure.&lt;/p&gt;  &lt;p&gt;So, tonight I did some more searches and found at least two other copies of the same post, one with absolutely no link back at all to my blog. More searches turned up other copies of my posts. So, am I upset? Heck yeah! What can I do about it? Probably nothing. I did a &lt;a href="http://domains.whois.com/" target="_blank"&gt;WhoIs&lt;/a&gt; search on one of the domains and practically had to download a new font to display the name of the registered domain owner. I won’t mention the sites here as I am loathe to do anything to raise their SEO rankings. &lt;/p&gt;  &lt;p&gt;My approach then will be (for now): to not care. I &lt;em&gt;will&lt;/em&gt; make a small gesture of adding a copyright notice to the bottom of each posting, even though legally this is not necessary, and, perhaps, adding a “Posted By: Andreas Zenker” tag as well. I’m not really thinking that this will actually stop these sites from scraping my content into their little pay-per-click campaign but maybe there stupid little servers will have to waste a few cycles parsing out some text before they copy my blog over. I’m sure the increased power consumption will cripple them. Take that! ;-)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update: 9/19/2009&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Actually the one site is in English, just hosted elsewhere. Funny thing is I see a new track-back from that site this morning. Once again my post is copied in full, the only reason there is a link to me at all is that I embedded a link to my blog in this post. Maybe that is the secret! I will make the copyright tag a link back to me. Also, they didn't waste any cycles on removing the copyright tag, it got copied as well. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="center"&gt;Posted on &lt;a href="http://weblogs.asp.net/"&gt;ASP.NET Weblogs&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; © Copyright 2009 - &lt;a href="http://weblogs.asp.net/andreaszenker/default.aspx" target="_blank"&gt;Andreas Zenker&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;</description><pubDate>Sat, 19 Sep 2009 04:06:14 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/is-my-blog-worth-stealing</guid><category>.NET</category><category>personal blogging</category><category>Writing</category></item><item><title>SharePoint List Item: Delete vs.. DeleteItemById</title><link>https://weblogs.asp.net:443/andreaszenker/sharepoint-list-item-delete-vs-deleteitembyid</link><description>&lt;p&gt;If you had to choose one of these methods to call to delete an item in a large list which would you choose? Here are your options in code &lt;/p&gt;  &lt;pre class="csharpcode"&gt;1: myListItem.Delete()&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class="csharpcode"&gt;2: mylist.Items.DeleteItemById(deleteItemId)&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Option 2 sounds good here doesn’t it? You have the id, the key to the item in the list, so giving the SPLIstItemCollection this valuable piece of information should make it a simple matter to kill off said SPListItem, no? Well – no. It would be great if, behind the scenes, this was translated to a SQL query like “delete mylist where iitemId = id”. That, however, is not the case. This is the SharePoint object model where men are men and lists are searched in memory. Thanks to &lt;a href="http://www.red-gate.com/products/reflector/"&gt;Reflector&lt;/a&gt; we can see that the DeleteById() method call follows this thread:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; DeleteItemById(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; id &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt;) 
    &lt;span class="kwrd"&gt;Me&lt;/span&gt;.GetItemById(id).Delete 
&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;        

Which calls … &lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt; GetItemById(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; id &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt;) &lt;span class="kwrd"&gt;As&lt;/span&gt; SPListItem 
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; itemIndexById &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt; = &lt;span class="kwrd"&gt;Me&lt;/span&gt;.GetItemIndexById(id) 
    &lt;span class="kwrd"&gt;If&lt;/span&gt; (itemIndexById &amp;lt; 0) &lt;span class="kwrd"&gt;Then&lt;/span&gt; 
        &lt;span class="kwrd"&gt;Throw&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; ArgumentException 
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt; 
    &lt;span class="kwrd"&gt;Me&lt;/span&gt;.EnsureListItemIsValid(itemIndexById) 
    &lt;span class="kwrd"&gt;If&lt;/span&gt; (&lt;span class="kwrd"&gt;Me&lt;/span&gt;.m_iColection &lt;span class="kwrd"&gt;Is&lt;/span&gt; &lt;span class="kwrd"&gt;Nothing&lt;/span&gt;) &lt;span class="kwrd"&gt;Then&lt;/span&gt; 
        &lt;span class="kwrd"&gt;Return&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; SPListItem(&lt;span class="kwrd"&gt;Me&lt;/span&gt;, itemIndexById) 
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt; 
    &lt;span class="kwrd"&gt;Return&lt;/span&gt; &lt;span class="kwrd"&gt;Me&lt;/span&gt;.m_iColection.ItemFactory(itemIndexById) 
&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt; &lt;/pre&gt;

&lt;p&gt;First line of GetItemById() needs &lt;span class="kwrd"&gt;to&lt;/span&gt; resolve the index of the item. Only one way &lt;span class="kwrd"&gt;to&lt;/span&gt; &lt;span class="kwrd"&gt;do&lt;/span&gt; that (emphasis in red) … &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Friend&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt; GetItemIndexById(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; id &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt;) &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt; 
    &lt;span class="kwrd"&gt;Me&lt;/span&gt;.EnsureListItemsData 
    &lt;span class="kwrd"&gt;Me&lt;/span&gt;.EnsureFieldMap 
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; num &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt; = 0 
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; columnNumber &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt; = &lt;span class="kwrd"&gt;Me&lt;/span&gt;.m_mapFields.GetColumnNumber(&lt;span class="str"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;) 
  &lt;font color="#ff0000"&gt; &lt;strong&gt; &lt;span class="kwrd"&gt;Do&lt;/span&gt; &lt;span class="kwrd"&gt;While&lt;/span&gt; (num &amp;lt; &lt;span class="kwrd"&gt;Me&lt;/span&gt;.m_iRowCount)&lt;/strong&gt;&lt;/font&gt; 
        &lt;span class="kwrd"&gt;If&lt;/span&gt; (Convert.ToInt32(&lt;span class="kwrd"&gt;Me&lt;/span&gt;.m_arrItemsData(columnNumber, num), CultureInfo.InvariantCulture) &amp;lt;&amp;gt; id) &lt;span class="kwrd"&gt;Then&lt;/span&gt; 
            num += 1 
            Continue &lt;span class="kwrd"&gt;Do&lt;/span&gt; 
        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt; 
        &lt;span class="kwrd"&gt;Return&lt;/span&gt; num 
    &lt;span class="kwrd"&gt;Loop&lt;/span&gt; 
    &lt;span class="kwrd"&gt;Return&lt;/span&gt; -1 
&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt; &lt;/pre&gt;

&lt;p&gt;&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;So, Item.Delete() must be the way to go? Well … yes … &lt;em&gt;if &lt;/em&gt;you already have the item reference, because then the work is already done. However, if you need to get the item first using GetItemById() then guess where you would end up again? That’s right, GetItemIndexById() and we are back to where we started. It really comes down to a “pay me now or pay me later” situation when choosing between these two methods. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;So, how to make it better? Replace either the Get or the Delete with a CAML query which pushes the heavy lifting back to the database (what a strange and mysterious concept, maybe it will catch on one day). Here is a method that constructs a CAML query to delete an item. The method accepts in the itemFileRef, which is what the CAML query needs to pass in to indentify the item in the Document Library to delete. Note: the query syntax is different based on list type, what works for a normal list will not necessarily&amp;#160; work on a document library and vice-versa.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;u&gt;&lt;strong&gt;Edit 9/18/2009&lt;/strong&gt;&lt;/u&gt;: the owsfileref value that is needed for this query to work can be obtained from the SPListItem object. If the SpListItem is an item in a document library you can call: myItem.Item(&amp;quot;FileRef&amp;quot;), which will return the needed value.&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; DeleteReport(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; itemFileRef &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;) 

        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; site &lt;span class="kwrd"&gt;As&lt;/span&gt; SPSite = &lt;span class="kwrd"&gt;Nothing&lt;/span&gt; 
        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; web &lt;span class="kwrd"&gt;As&lt;/span&gt; SPWeb = &lt;span class="kwrd"&gt;Nothing&lt;/span&gt; 
        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; list &lt;span class="kwrd"&gt;As&lt;/span&gt; SPDocumentLibrary = &lt;span class="kwrd"&gt;Nothing&lt;/span&gt; 

        &lt;span class="kwrd"&gt;Try&lt;/span&gt; 
            site = &lt;span class="kwrd"&gt;New&lt;/span&gt; SPSite(SPContext.Current.Site.Url) 
            web = site.RootWeb 

            list = web.GetList(MySettings.RelativeListURL(web) &amp;amp; MyListConfig.ListName) 

            &lt;span class="kwrd"&gt;Dim&lt;/span&gt; sbDelete &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; System.Text.StringBuilder 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;?xml version=&amp;quot;&lt;/span&gt;&lt;span class="str"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;span class="str"&gt;&amp;quot; encoding=&amp;quot;&lt;/span&gt;&lt;span class="str"&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class="str"&gt;&amp;quot;?&amp;gt;&amp;lt;Batch&amp;gt;&amp;quot;&lt;/span&gt;) 
            &lt;span class="kwrd"&gt;Dim&lt;/span&gt; delCount &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt; = 0 

            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;Method&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;SetList Scope='Request'&amp;gt;&amp;quot;&lt;/span&gt; &amp;amp; list.ID.ToString &amp;amp; &lt;span class="str"&gt;&amp;quot;&amp;lt;/SetList&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;SetVar Name='Cmd'&amp;gt;DELETE&amp;lt;/SetVar&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;SetVar Name='ID'&amp;gt;1&amp;lt;/SetVar&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;SetVar Name='owsfileref'&amp;gt;&amp;quot;&lt;/span&gt; &amp;amp; itemFileRef &amp;amp; &lt;span class="str"&gt;&amp;quot;&amp;lt;/SetVar&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;/Method&amp;gt;&amp;quot;&lt;/span&gt;) 
            sbDelete.Append(&lt;span class="str"&gt;&amp;quot;&amp;lt;/Batch&amp;gt;&amp;quot;&lt;/span&gt;) 

            &lt;span class="kwrd"&gt;Try&lt;/span&gt; 
                web.AllowUnsafeUpdates = &lt;span class="kwrd"&gt;True&lt;/span&gt; 
                web.ProcessBatchData(sbDelete.ToString()) 
            &lt;span class="kwrd"&gt;Catch&lt;/span&gt; ex &lt;span class="kwrd"&gt;As&lt;/span&gt; Exception 
                &lt;span class="kwrd"&gt;Throw&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; Exception(&lt;span class="str"&gt;&amp;quot;Error deleting items from list: &amp;quot;&lt;/span&gt; &amp;amp; ex.GetBaseException.ToString) 
            &lt;span class="kwrd"&gt;Finally&lt;/span&gt; 
                web.AllowUnsafeUpdates = &lt;span class="kwrd"&gt;False&lt;/span&gt; 
            &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Try&lt;/span&gt; 



        &lt;span class="kwrd"&gt;Catch&lt;/span&gt; ex &lt;span class="kwrd"&gt;As&lt;/span&gt; Exception 
            &lt;span class="kwrd"&gt;Throw&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; Exception(&lt;span class="str"&gt;&amp;quot;Error deleting items from list: {0}&amp;quot;&lt;/span&gt;, ex) 
        &lt;span class="kwrd"&gt;Finally&lt;/span&gt; 
            &lt;span class="kwrd"&gt;If&lt;/span&gt; &lt;span class="kwrd"&gt;Not&lt;/span&gt; web &lt;span class="kwrd"&gt;Is&lt;/span&gt; &lt;span class="kwrd"&gt;Nothing&lt;/span&gt; &lt;span class="kwrd"&gt;Then&lt;/span&gt; 
                web.Dispose() 
            &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt; 
            &lt;span class="kwrd"&gt;If&lt;/span&gt; &lt;span class="kwrd"&gt;Not&lt;/span&gt; site &lt;span class="kwrd"&gt;Is&lt;/span&gt; &lt;span class="kwrd"&gt;Nothing&lt;/span&gt; &lt;span class="kwrd"&gt;Then&lt;/span&gt; 
                site.Dispose() 
            &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt; 

        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Try&lt;/span&gt; 

    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; &lt;/pre&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;This &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; trace shows the non-trivial performance boost you can get from re-factoring a delete from using the object model to using a CAML query as shown above. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/camlPerf_0CB4503D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="camlPerf" border="0" alt="camlPerf" src="https://aspblogs.blob.core.windows.net/media/andreaszenker/Media/camlPerf_thumb_2F28DEF8.png" width="658" height="145" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;Now, if your lists are small you will not see this kind of improvement, and if you have no expectation that your lists will ever get large then you may be safe using the object model provided delete options. However, if that is not the case check out CAML before you go to production.&lt;/font&gt;&lt;/p&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p align="center"&gt;© Copyright 2009 - Andreas Zenker&lt;/p&gt;</description><pubDate>Tue, 08 Sep 2009 00:12:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/sharepoint-list-item-delete-vs-deleteitembyid</guid><category>.NET</category><category>ASP.NET</category><category>CAML</category><category>SharePoint</category></item><item><title>New entry to blog roll – John Robbins</title><link>https://weblogs.asp.net:443/andreaszenker/new-entry-to-blog-roll-john-robbins</link><description>&lt;P&gt;&lt;A href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/07/13/easier-multithreaded-debugging.aspx" target=_blank mce_href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/07/13/easier-multithreaded-debugging.aspx"&gt;This most recent post by John Robbins&lt;/A&gt; is what motivated me to add his blog to my blog roll. However, it has been a must read for a while now. This post is actually more “fluffy” than most for him, I just loved the insight into things macros can do that I hadn’t considered like setting breakpoints with custom conditions. Also liked the code he used to validate that the current window in the IDE was in fact a code file before moving forward with the macro. I pulled that method out and added it to my common module of macros.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Thu, 16 Jul 2009 09:34:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/new-entry-to-blog-roll-john-robbins</guid><category>.NET</category><category>Debugging</category><category>macros</category><category>VB</category><category>Visual Studio</category></item><item><title>The Achilles Thread</title><link>https://weblogs.asp.net:443/andreaszenker/the-achilles-thread</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Sunday, November 18, 2007&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;"[when debugging] If you see hoof prints think horses, not zebras".&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hunt and Thomas, in &lt;A href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X" mce_href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X"&gt;The Pragmatic Programmer&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Developing in the brave new world of managed memory and garbage collection we, in most cases, don't have to worry about the details of memory allocation and clean-up. However, when our application starts having memory issues, we can easily have a tendency to fall into one of two camps:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;Assuming all memory issues are memory leaks (i.e. objects not being disposed of properly) &lt;/LI&gt;
&lt;LI&gt;Assuming that garbage collection is not working as stated. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Both of these assumptions are flawed in one common way: they narrow our focus to a limited set of possibilities and that affects the way we approach the problem. Sparing you the cutesy saying about what happens when we ass-u-me, it is fair to say that assumptions cripple any debugging effort. Once we assume we lose control over the "scientific" process of debugging a problem. In this case we had a utility application consuming egregious amounts of data, 1 to 1.5 gb of memory just to process a queue. I immediately assumed a traditional memory leak, as we were dealing with MSMQ, MessageEnumerators, Messages, SqlConnections, SqlCommands etc, I figured something was not getting disposed of or was still gcroot-ed somewhere in the code.&lt;/P&gt;
&lt;P&gt;Problem scenario: In a console application we are iterating thru 85,000 messages in a "dead-letter" queue to see if we can salvage the data that never made it to its destination, the database. As we iterate thru the queue we pass off each message to a handler designed for that particular type of message using a factory. The handler de-serializes the message body back into the original object, generates a SQL insert based on the message contents and inserts a row in the database. As each handler returns a result, messages are removed from or left on the MessageQueue. Rinse, repeat. &lt;/P&gt;
&lt;P&gt;If we remove the call to the datalayer component that is writing the new rows in the DB, the memory issue goes away. So clearly we have some SqlProvider objects not getting disposed of, right? Wrong. In surgically adding back in the datalayer functionality one method at a time it becomes clear that just opening a connection to the database once is all it takes to create the issue. Comment out the line that creates the connection, no memory issue, add it back in the death spiral returns. &lt;/P&gt;
&lt;P&gt;To see if I could reproduce that scenario with fresh code, I reproduce the functionality from the ground up in a Windows Form application to make debugging more friendly. I set up a few different scenarios and, just to make the experience more lively, I add some counters to the forms so I can see how many messages have been processed etc. I take all the same steps as described above and..... no memory issue. I start reviewing the code method by method to see what I am doing differently. I find nothing, everything is exactly the same.....except.....in the windows form I am publishing messages to the GUI using a quick and dirty "DoEvents" call in the loop, who wants to stare at a frozen form? Then it hits me, I remove the DoEvents and the memory issue is back. Now that I have, not an assumption, but the real problem description it doesn't take long to find the answer as the links below will point you to. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx" mce_href="http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx"&gt;Maoni Article on Finalizers&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.microsoft.com/kb/828988" mce_href="http://support.microsoft.com/kb/828988"&gt;Microsoft Whitepaper&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_thread/thread/7740b1d7afcd3b7e/90e2812cf55da065?lnk=st&amp;amp;q=stathread&amp;amp;pli=1" mce_href="http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_thread/thread/7740b1d7afcd3b7e/90e2812cf55da065?lnk=st&amp;amp;q=stathread&amp;amp;pli=1"&gt;Google Groups Thread&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The short answer proved to be this: In console apps the Main() form is launched by default on a Single Threaded Apartment Thread (STA). The same is true of a Windows form app and it's GUI thread. The STA model keeps that thread safe from multi-threading issues, especially when using COM objects that are acting like they are all alone in the world. So, when a COM component is created, used and released on an STA thread, it needs to be finalized. The finalizer thread has to wait until it is "invited to the party" in order to finalize that object. If the STA thread is in a long running loop, and is not publishing messages (ala DoEvents, Thread.Join() etc) then the finalizer is blocked until the loop is done and the STA thread takes a breath. This explains how one database connection could kill this app. The connection was ready to be finalized, the finalizer queues up to process that but is blocked waiting for the STA thread to take a breath. Meanwhile the STA thread is cranking thru a huge Queue and leaving an Exxon Valdez size slick of managed objects who are waiting on guess who, the finalizer thread. &lt;/P&gt;
&lt;P&gt;The suggested solution: add an MTAThread() attribute to the entry point of your application (Sub Main() ) to prompt the runtime to load your main thread in Multi Thread Apartment (MTA) mode, now the finalizer can sneak in and do its clean up even though the main loop is not making any effort to share.&lt;/P&gt;
&lt;P&gt;So, it wasn't quite horses, but not full-bred zebras either. Either way it was a fun ride.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:58:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/the-achilles-thread</guid><category>.NET</category><category>Debugging</category><category>threading</category><category>VB</category><category>Visual Studio</category></item><item><title>Forest for the trees – Don’t forget the compiler</title><link>https://weblogs.asp.net:443/andreaszenker/forest-for-the-trees-don-t-forget-the-compiler</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Wednesday, June 6, 2007&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Back in school my teacher was not much on the formal aspects of the course he was teaching.He was instead, as I describe him, the kind of guy you could imagine living in his room with his PC, hacking away, his mom pushing crackers under the door and begging "You really should go out and get some friends dear." Perhaps because of that we spent less time in the text book and more time digging into just what the IDE, along with COM and MTS at the time, were doing underneath the hood to be "helpful". He often said that memorizing the text book would help you pass but that knowing what was really happening based on your code would give you a better ability to figure things out when debugging "weirdness". For some reason I thought of him just today. :-)&lt;/P&gt;
&lt;P&gt;The "weirdness" in this case was that my IDE was doing strange stuff in debug mode, or so I thought at the time. I was trying to see why my property based on a config setting was never getting populated with the correct value. So I did the natural thing, I set a break point on the property get and fired it up. The basic code of the getter was this&lt;/P&gt;
&lt;P&gt;Get &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim prop As Boolean = False &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim configVal As String = System.Configuration.ConfigurationSettings.AppSettings.Item("MyConfigKey") &lt;BR&gt;If Not configval Is Nothing Then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prop = CBool(configVal) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return prop &lt;BR&gt;End Get &lt;/P&gt;
&lt;P&gt;Nothing fancy, but when debugging I found that the If statement never seemed to evaluate to true, and the if block never executed. The debugger would always jump to End If no matter what I set the value of configVal to in the command window. Somebody wiser than me once said something along the lines of "always look for the stupidest solution first", however with this "weirdness" I immediately launched into the "weirdness countermeasures". These included restarting the IDE, rebuilding the solution, bleaching the temp files in case I was somehow stuck with an old version of the file from a previous life, rebooting, rinse repeat. All of the maneuvers that have served well in the past when bizarre things happen in the IDE. No dice, still same issue every time. &lt;/P&gt;
&lt;P&gt;Now it's time for last resort "I have no idea, but I'll try this" measures. In the past I have had lines of code that would not compile with no apparent error and only way to resolve the issue was to retype the line, visually identical to the "bad" line, and all-of-a-sudden the IDE was happy again and we moved on. Whatever! So I figured I would give that a try. As I was re-typing the code I found a bug, seemed stupid and meaningless at first, but it then hit me that it had been the issue all along. In my getter the actual code looked like this&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Get &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim prop As Boolean = False &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim configVal As String = System.Configuration.ConfigurationSettings.AppSettings.Item("MyConfigKey") &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not configval Is Nothing Then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prop = CBool(prop) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return prop &lt;BR&gt;End Get&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I was setting the prop variable to the result of CBool(prop) as boolean of itself, which would always mean no change to the variable. Then the lights in my dark and scary brain started to go on! The compiler was &lt;EM&gt;helping&lt;/EM&gt; me! I compiled the code again and looked at the disassembly, first with the bug&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If Not configval Is Nothing Then &lt;BR&gt;&lt;/STRONG&gt;00000036 test ebx,ebx &lt;BR&gt;00000038 je 0000003A &lt;BR&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;and then without&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If Not configval Is Nothing Then &lt;BR&gt;&lt;/STRONG&gt;00000036 test esi,esi &lt;BR&gt;00000038 je 0000004E &lt;BR&gt;&lt;STRONG&gt;prop = CBool(configVal) &lt;BR&gt;&lt;/STRONG&gt;0000003a mov ecx,esi &lt;BR&gt;0000003c call FFB91FD0 &lt;BR&gt;00000041 movzx edi,al &lt;BR&gt;00000044 mov eax,edi &lt;BR&gt;00000046 and eax,0FFh &lt;BR&gt;0000004b mov dword ptr [ebp-8],eax &lt;BR&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The compile decided that the stupid line of code was irrelevant and simply removed it. So in debugging, since we are actually stepping through the debug symbols, not the code, there &lt;EM&gt;was&lt;/EM&gt; no line of code to hit in that If block. So the supposed "weirdness" just turned out to be a bad cut and paste. Doh! If the compiler had left it in I would have seen the line execute with no change to the value of prop and found the bug right away. Instead I get all commando. &lt;/P&gt;
&lt;P&gt;Anyway, I just had to share my brain cramp. When things seem "weird" don't forget:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;a) the "always look for the stupidest solution first" rule still applies&lt;/P&gt;
&lt;P&gt;b) don't forget what might be trying to "help" you under the hood.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description><pubDate>Sat, 11 Jul 2009 02:54:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/forest-for-the-trees-don-t-forget-the-compiler</guid><category>.NET</category><category>ASP.NET</category><category>Debugging</category><category>VB</category><category>Visual Studio</category></item><item><title>What is a clustered index anyway?</title><link>https://weblogs.asp.net:443/andreaszenker/what-is-a-clustered-index-anyway</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Saturday, February 17, 2007&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Wanted to drop a quick post for two reasons: 1) To prove I have not died, been abducted by aliens, or been confined to a room with soft, cushy walls and a nerf PC for my own "protection". 2) To give a plug for someone I had an opportunity to work with this past week.&lt;/P&gt;
&lt;P&gt;Our shop was in need of some SQL Server performance tuning. Not having the expertise in house we called in an outside consultant. Not having had the best experiences with outside "experts" in the past, I was skeptical. However, &lt;A href="http://www.gothamconsulting.com/" mce_href="http://www.gothamconsulting.com/"&gt;Ray Rankins and his Gotham Consulting&lt;/A&gt; seem to be the real deal. Not living in the SQL world day in and day out, I tend to leave the "deeper thoughts" to the DBA's and worry about the procs doing what I need when I need it. However, when it does come down to a proc that is dogging our application down, it would be nice to really understand &lt;EM&gt;why&lt;/EM&gt; one syntax or set of indexes works so much better than another. Usually the approach to tuning a long running proc from a developer standpoint is "Well, that sucks, let's try something else" and "Wow, that sucks a lot less, let's do that!" Speaking with Ray this past week I found a man who knows, and seems to care, about what is happening under the hood in SQL Server as much as I do about the inner workings of the CLR. The longer I work in this field the more I realize that this kind of person is hard to find. In one ten minute conversation I now have a really good idea what a Clustered vs. a Non-Clustered index is, why it matters, what situations you would want to use either of them etc. Ray has written &lt;A href="http://www.amazon.com/Microsoft-SQL-Server-2008-Unleashed/dp/0672330563/ref=sr_1_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1247280561&amp;amp;sr=1-3" mce_href="http://www.amazon.com/Microsoft-SQL-Server-2008-Unleashed/dp/0672330563/ref=sr_1_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1247280561&amp;amp;sr=1-3"&gt;"the book"&lt;/A&gt; [&lt;EM&gt;note: updated link to latest edition of book when recovering blog post -- AZ&lt;/EM&gt;] on SQL Server and is just making the final edits on the SQL 2005 edition. I think I will add it to my ever growing stack of books to read one rainy day.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:51:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/what-is-a-clustered-index-anyway</guid><category>.NET</category><category>books</category><category>Database</category><category>SQL</category><category>SQL Server</category></item><item><title>slidingExpiration = NotReally timeout = NotWhatIThinkItIs</title><link>https://weblogs.asp.net:443/andreaszenker/slidingexpiration-notreally-timeout-notwhatithinkitis</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Wednesday, October 25, 2006&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As a new approach to some meaningful blogging, as I work on debugging some new bug/issue, the info I collect and my deductions I record right in my LiveWriter window so that I can save any links, code snippets etc. This way, with little effort, at the end of the day I can do some quick editing and post something "useful" (you may choose to retain your own definition of that word). A fringe benefit is that I can find this info again the next time I need it.&lt;/P&gt;
&lt;P&gt;So here was the situation:&lt;/P&gt;
&lt;P&gt;An ASP.NET application that leverages FormsAuthentication. The timeout is set in the web.config to 20 minutes in the authentication tag something like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Users were reporting intermittent timeouts that were significantly less than the 20 minutes. In testing we were unable to duplicate this scenario. &lt;/P&gt;
&lt;P&gt;The other important detail, that we have omitted until now, is that we are "rolling our own" authentication ticket in order to have more control over what that ticket contains etc. So in code the default ticket timeout value (set as a constant) was 20 minutes. &lt;/P&gt;
&lt;P&gt;So, now onto the mistaken assumptions. I had assumed that the web.config setting would come into effect the first time the ticket was updated. Being that it is a sliding expiration I had thought that the ticket would be updated to the web.config timeout the next time a page was requested. Since the user is redirected from the login page as a matter of course it was &lt;EM&gt;assumed (doh!) &lt;/EM&gt;that the hard-coded timeout value would not last longer than a second or two. So, the first thing I did was set the web.config timeout to be 1 minute so that I could test without waiting 20 minutes. Waited a minute .... posted back&amp;nbsp; ... no dice, still logged in. No matter what I set that value to I could not get kicked out if I tried. Only when I changed to constant to 1 in the code and recompiled was I able to get kicked out as expected. Ok, bad assumption, no big deal, we'll just change the code to read the config value when it sets the original ticket and then all will be in sync, right? Not so easy. &lt;/P&gt;
&lt;P&gt;First of all, the values in that section of the config are protected, even from the guy writing the application. The normal system.configuration approach does not expose these values and the FormsAuthentication classes do not expose what you would think is a fairly useful property. So how do you make sure you are in sync with the config file? Doing some googling we find that Scott Hanselman ran into the same thing years ago, no surprise. &lt;A href="http://www.hanselman.com/blog/AccessingTheASPNETFormsAuthenticationTimeoutValue.aspx" mce_href="http://www.hanselman.com/blog/AccessingTheASPNETFormsAuthenticationTimeoutValue.aspx"&gt;Scott details his thought process in solving the same issue.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Scott addresses the pain of accessing the config setting from code so that the first creation of the ticket can match the desired setting from the web config. He considers the approach of creating an additional, accessible, config setting that would require being set in two places or creating an invalid situation. (i.e. one setting says expire in 20 minutes, one says 10 etc). He considers reflection, but deems it too ugly. Finally he settles on dynamically "discovering" the web.config, loading into a DOM and xpathing his way to the setting and storing in cache so he only has to do it once. Basically there is no clean work-around so you have to settle for a lesser of the evils approach.&lt;/P&gt;
&lt;P&gt;So, armed with that information we start testing with our new found knowledge. We had written a test page to dump out the contents of the ticket to a text box so that we could see what expiration was actually being set. We set the original ticket being written by the code to a nice small value of 4 minutes and started to post the page back. Here comes the strangeness. As we post the page back the expiration time of the ticket does not change. We keep posting the page back every 15 seconds or so and &lt;EM&gt;eventually&lt;/EM&gt; it decided it was time to update the ticket with a new expiration time. Now were really confused, this was, after all, a sliding expiration wasn't it? Every time the page posts back it was supposed to update the time to give another &lt;EM&gt;n&lt;/EM&gt; minutes before it would be timed out. So back to digging, this time we pull up the MSDN documentation on the tag and the element. &lt;A href="http://msdn.microsoft.com/en-us/library/1d3t3c61%28VS.71%29.aspx" mce_href="http://msdn.microsoft.com/en-us/library/1d3t3c61%28VS.71%29.aspx"&gt;MSDN documentation on element attributes.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The msdn docs indicate that a sliding expiration does not really slide as you might imagine, and certainly may expire when you do not expect it to. Here is a priceless, if not a bit contradictory bit of MS wisdom: "&lt;EM&gt;If the SlidingExpiration attribute is true, the timeout attribute is a sliding value, expiring at the specified number of minutes after the time the last request was received. To prevent compromised performance, and to avoid multiple browser warnings for users that have cookie warnings turned on, the cookie is updated when more than half the specified time has elapsed. &lt;STRONG&gt;This might result in a loss of precision.&lt;/STRONG&gt;&lt;/EM&gt;.", I guess! A "loss of precision"? Is that what we call a sliding expiration that doesn't slide and results in an effective timeout of only half what you think you set it to? So, because some people are afraid of the big bad cookie monster we are going to totally hose the well understood concept of a sliding expiration, with no "override this stupid default behavior" attribute in sight? That is insane. Now it's time to pull out Reflector and look for a clever workaround.&lt;/P&gt;
&lt;P&gt;Inside the FormsAuthentication class we find the method that does just as described, renews the ticket only if the time left till expiration is greater than the time since the current ticket was issued.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Shared&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Function&lt;/SPAN&gt; RenewTicketIfOld(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; tOld &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; FormsAuthenticationTicket) &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; FormsAuthenticationTicket
      &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (tOld &lt;SPAN class=kwrd&gt;Is&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; time1 &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; DateTime = DateTime.Now
      &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; span1 &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TimeSpan = &lt;SPAN class=kwrd&gt;DirectCast&lt;/SPAN&gt;((time1 - tOld.IssueDate), TimeSpan)
      &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; span2 &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TimeSpan = &lt;SPAN class=kwrd&gt;DirectCast&lt;/SPAN&gt;((tOld.Expiration - time1), TimeSpan)
      &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (span2 &amp;gt; span1) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; tOld
      &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; FormsAuthenticationTicket(tOld.Version, tOld.Name, time1, _
                      (time1 + (tOld.Expiration - tOld.IssueDate)), _
                      tOld.IsPersistent, tOld.UserData, tOld.CookiePath)
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Function&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;Unfortunately the method is completely self contained and is not using any other settings to determine its results. It bases the decision on whether or not to update the ticket completely on the lifespan of the current ticket and the current time. If more then half the time has elapsed then you get a new one, period. So no work-around presents itself.&lt;/P&gt;
&lt;P&gt;Something else we learn from this code is that, if you are manually setting the original ticket, the setting in the web.config, if different, never comes into play, since the renew method is basing its renew length on the originally set length of the ticket not your silly little timeout setting. This setting just gets more useless as we go on!&lt;/P&gt;
&lt;P&gt;Now, if you use the out-of-the-box authorization that is provided in the framework and set your ticket using the FormsAuthentication.SetAuthCookie(username,isPersistent,cookiePath) method, the config setting will hold true when the ticket is created for you, however the non-sliding expiration issue still holds true.&lt;/P&gt;
&lt;P&gt;So, enough pain for one day, how are we going to "fix" this so that the user has the result they expect, a 20 minute timeout? First we have to sync up our code creation of the first ticket with the web.config value. I wasn't fond of Scott's xml loading solution, although it would work. Since we found that, &lt;EM&gt;in our case&lt;/EM&gt;, the web.config setting was moot anyway We opt for adding a new value to the web.config to explicitly set the value the code would use, afterward the framework would continue to re-apply this value as it refreshed the cookie. This does not provide any actual conflict, but it may provide some confusion as the app is deployed and maintained. The nice thing, for once, is that the timeout attribute on the element is optional and defaults to 30 minutes. Since it is never going to be applied, what do we care? So we remove the attribute and thus remove the &lt;EM&gt;apparent&lt;/EM&gt; conflict in settings. &lt;/P&gt;
&lt;P&gt;Now, what can we do about the non-sliding expiration? Well, it's been a long enough day, so we opt for the easy: "Just double it stupid" approach. This could, if we were relying completely on the forms authentication for timeouts, allow users, in some cases, to get anywhere from 20 to 40 minutes timeout, which would be considered a problem as well. However, since we are also requiring a fresh login when the session times out, we are covered. We set the config timeout to twice what the session timeout is and we are good. The shortest the ticket will live is 20 minutes between clicks, and if it lives longer than that the session will tank and all is well.&lt;/P&gt;
&lt;P&gt;Now you may have a more elegant solution, so feel free to share...&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:43:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/slidingexpiration-notreally-timeout-notwhatithinkitis</guid><category>.NET</category><category>ASP.NET</category><category>Authentication</category><category>Debugging</category><category>VB</category></item><item><title>That which we call a Namespace, by any other name would just smell.</title><link>https://weblogs.asp.net:443/andreaszenker/that-which-we-call-a-namespace-by-any-other-name-would-just-smell</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Tuesday, June 27, 2006&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;There is nothing sweet about spending hours, days, evenings and weekends chasing "ghosts" in your code. In this context "ghosts" mean compile or runtime errors that are not constant, only dreadfully persistent. Perhaps you also have been faced with the intermittent errors that look something along the lines of this:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Could not load type Foospace.FooWebService.FooWS.FooInfo from assembly mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;or&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Could not load type 'FooSpace.Global'. &lt;BR&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Now, huge caveat here, these types of error could be caused by a plethora of things, even perhaps a &lt;A href="http://www.garnersclassics.com/qamigos.htm" mce_href="http://www.garnersclassics.com/qamigos.htm"&gt;plethora of pinatas,&lt;/A&gt; but most would provide constant errors on every build or execution. I have found a surprising dearth of information on this scenario, its cause and resolution. So the situation I am about to describe may not match yours, but if it does I hope it helps. &lt;/P&gt;
&lt;P&gt;Note first of all that the type I am failing to load is a type defined in a Web Service that my project is calling into. We can imagine that the FooWebService returns a type of FooInfo from a method called GetFoo. (&lt;EM&gt;What would we doo without foo?&lt;/EM&gt;) This is a standalone service and as such does not share any references with our main application so that is enough info about that. Our main application, to start will just have one project: FooApp, it has a Web Reference defined pointing to FooWS and uses that to get and display FooInfo properties on the page when it loads. So far so good.&lt;/P&gt;
&lt;P&gt;Now we start to build our application into a solution that we expect to get quite large so we start using Namespaces to categorize our projects. So now we go to our project properties and change the Root Namespace from the default FooApp to FooSpace. When we do this now our project won't run because our global.asax and our webform.aspx files have statements like this: Inherits="FooApp.WebForm1" that need to be changed to read Inherits="FooSpace.WebForm1". At this point something should be telling us that namespaces are more than just a way to organize our code and get pretty little intellisense dropdowns when we are defining our objects. Anyway, we shake off the annoyance and move on, once again our project loads and we are good. We also do the same for the FooWebService Project, as the first segment of the namespace is often a company or overall product name, this makes sense.&lt;/P&gt;
&lt;P&gt;Now we add the ever essential FooLibrary project to our solution. To keep in form we change its root namespace to match our new structure, "Foospace". Notice the typo? the &lt;STRONG&gt;"S"&lt;/STRONG&gt; is not the same case as our FooApp Root Namespace. Now Visual Basic is case insensitive, so it shouldn't care, right? Wrong, way wrong. In fact, it seems, the compiler can't tell the two apart so sometimes when it is looking for a resource to load it will use the correct namespace, other times it will not. To prove it to yourself, add a reference in your FooApp web project to the new FooLibrary. You don't even need to call anything, or add any import statements. You should start having issues right away. I was going to try to document all the different variations you might see based on your setup but here are a few.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;If your Web Reference is static you may get compile errors right away. Lucky you!&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;If your Web Reference is Dynamic you may get past the compile but will likely fail on loading the global.asax for no apparent reason. &lt;/LI&gt;
&lt;LI&gt;If your reference to the badly namespaced project lives in another project, say a business object layer that calls upon the FooLibrary, the code could compile and even run. Until one day you start to get weird "Could not load type" messages. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So the basic point of this post is: A Namespace is case sensitive! Whatever .NET language you call home. Our shop ran into this well over a year ago. Just recently it came back into our solution by way of some new project namespacing that had been done and its "avatar" was completely different. On the first go-round we mostly had the issues loading global.asax, still intermittently build by build. On the latest flare up we had the error calling a Web Service well down in the application, once again random build to build. Because the evidence was so different we chased some ghosts before we, once again, identify the culprit. To be fair, I did find &lt;A href="http://davidcrowell.com/" mce_href="http://davidcrowell.com/"&gt;one blog that did mention this issue quite some time ago&lt;/A&gt;, so I will link to it here. Scroll down the page and look for the header: "&lt;EM&gt;VB &amp;amp; C# Casing Issues with VS.NET "&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:34:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/that-which-we-call-a-namespace-by-any-other-name-would-just-smell</guid><category>.NET</category><category>ASP.NET</category><category>Debugging</category><category>VB</category><category>Visual Studio</category></item><item><title>It is Truly the Simple Pleasures In Life</title><link>https://weblogs.asp.net:443/andreaszenker/it-is-truly-the-simple-pleasures-in-life</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Monday, April 24, 2006&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The recent project list on the start page of the Visual Studio IDE seems like such a cool thing at first glance. However, very quickly it degrades into the "How many times do I have to be reminded that I called my test project 'Son of Foo'" list. We end up with junk in there that is just plain annoying. Recently our shop made a move to Subversion for source control, finally giving Visual Source Safe the merciful lethal injection that it so deserved. In the process I cleaned up and moved my local working copy of code to a new folder. So now I not only was reminded of every time I created a test project named "WebApplication1" in the past month, but I also was faced with duplicate entries of "My Solution" in the list, one real one just a mirage. Needless to say I clicked on the mirage enough times to be motivated to google on how to clean up the recent project list. In doing so I found this very light-weight, and useful, util &lt;A href="http://www.codeproject.com/KB/dotnet/VSProjectListEditor.aspx" mce_href="http://www.codeproject.com/KB/dotnet/VSProjectListEditor.aspx"&gt;here&lt;/A&gt;. Thanks to Josh Beach (whoever you are) and the guys at &lt;A href="http://weblogs.asp.net/controlpanel/blogs/www.codeproject.com/index.asp" mce_href="www.codeproject.com/index.asp"&gt;CodeProject&lt;/A&gt; for this useful little number. It truly made my day.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:29:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/it-is-truly-the-simple-pleasures-in-life</guid><category>Visual Studio</category></item><item><title>Doing it With Style</title><link>https://weblogs.asp.net:443/andreaszenker/doing-it-with-style</link><description>&lt;P&gt;&lt;FONT color=#808040&gt;Recovered from DotNetJunkies blog -- Originally Posted: Tuesday December 27, 2005&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Most of my personal (read: "for fun") programming time lately has been involved with web design. Being much more comfortable hiding behind a nice solid business object, this is largely uncharted territory for me and, as such, provides the comfortable, nearly vertical, learning curve that we know and love. I decided up front that I was going to "do it right" and not fall back on the old &amp;lt;table&amp;gt; method of laying out the page contents. I had read, and heard, about the advantages of CSS based page layout, but had not had any direct exposure. In my research of what is available on the web I have collected a short list of valuable CSS resources that I wanted to share. So here goes...&lt;/P&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=2 width=474&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=258&gt;The site that will make you a believer:&lt;/TD&gt;
&lt;TD vAlign=top width=214&gt;&amp;nbsp; &lt;A href="http://www.csszengarden.com/" mce_href="http://www.csszengarden.com/"&gt;CSS Zen Garden&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=258&gt;Practical layout tips and tutorials:&lt;/TD&gt;
&lt;TD vAlign=top width=214&gt;&amp;nbsp; &lt;A href="http://www.alistapart.com/" mce_href="http://www.alistapart.com/"&gt;A List Apart&lt;/A&gt; &lt;BR&gt;&amp;nbsp;&lt;A href="http://www.glish.com/css/" mce_href="http://www.glish.com/css/"&gt;glish.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=258&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD vAlign=top width=214&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;I would say that, hands down, the AListApart site has been the most valuable so far, especially this article on how to use negative margin values along with column defining background images to define your 2 or 3 column layout all in CSS and have it degrade nicely. &lt;A href="http://www.alistapart.com/articles/negativemargins/" mce_href="http://www.alistapart.com/articles/negativemargins/"&gt;Sweet!&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:25:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/doing-it-with-style</guid><category>.NET</category><category>ASP.NET</category><category>CSS</category></item><item><title>The blog is dead – long live the blog!</title><link>https://weblogs.asp.net:443/andreaszenker/the-blog-is-dead-long-live-the-blog</link><description>&lt;P&gt;One of the reasons I blog, despite all the fame and fortune it brings me ;-) , is the fact that I can record, for my own benefit, solutions I have found to problems. One day I will need to find a particular factoid again and Google will bring me back full circle to where I left it. At least that is the general plan.&lt;/P&gt;
&lt;P&gt;Today I was having an issue with namespaces. I was seeing namespaces differing only by case, e.g. myNamespace vs. MyNameSpace, and it was bringing back bad memories. I remembered that I had blogged about a similar problem once before and wanted to find that article to see if my problem might be similar. However, when I went to look for my old blog at DotNetJunkies.com, it was gone. Not just down, not just no longer supported, it was &lt;EM&gt;&lt;STRONG&gt;gone&lt;/STRONG&gt;&lt;/EM&gt;. When I first started this blog I considered migrating my old blogs to the new site but that seemed kind of harsh and, I thought naively, unnecessary. “I can just link to the old blog and life is good” I thought. Well … that was, in retrospect, pretty stupid. &lt;/P&gt;
&lt;P&gt;All, however, was not lost. I remembered that there are sites dedicated to storing cached versions of web sites for posterity. One such site that I owe my thanks to is &lt;A href="http://www.archive.org/web/web.php" mce_href="http://www.archive.org/web/web.php"&gt;The Wayback Machine&lt;/A&gt;.&amp;nbsp; Thankfully they don’t discriminate based on perceived value! I was able to find &lt;A href="http://web.archive.org/web/20071224200402/http://www.dotnetjunkies.com/WebLog/azenker/" mce_href="http://web.archive.org/web/20071224200402/http://www.dotnetjunkies.com/WebLog/azenker/"&gt;my old blog stored safely away in the archive&lt;/A&gt; and recover my lost content.&lt;/P&gt;
&lt;P&gt;So, thanks to the archives, I will be posting my old content here in the following posts. Re-posting feels a bit weird, kind of like making a “best of” album when I still don’t have a hit single but hey … it’s &lt;EM&gt;my&lt;/EM&gt; blog. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;© Copyright 2009 - Andreas Zenker&lt;/P&gt;</description><pubDate>Sat, 11 Jul 2009 02:16:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/andreaszenker/the-blog-is-dead-long-live-the-blog</guid><category>Personal</category><category>personal blogging</category></item></channel></rss>