<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bindable Run</title><link>http://blogs.msdn.com/b/text/archive/2009/09/01/bindable-run.aspx</link><description>Since the initial release of WPF, Run.Text has been a normal CLR property. This has meant that Run.Text lacks all the benefits of the WPF dependency property system, most notably the ability to be bound. In some cases, one could substitute Runs for TextBlock</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Bindable Run</title><link>http://blogs.msdn.com/b/text/archive/2009/09/01/bindable-run.aspx#9995432</link><pubDate>Tue, 13 Apr 2010 21:26:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9995432</guid><dc:creator>text</dc:creator><description>&lt;p&gt;Po-&lt;/p&gt;
&lt;p&gt;Short answer… &lt;/p&gt;
&lt;p&gt;This example doesn’t really show justification. That is a byproduct of how the Run is doing linebreaking.&lt;/p&gt;
&lt;p&gt;Long answer…&lt;/p&gt;
&lt;p&gt;When reexamining the code snippet, I realize that I could have more clearly conveyed the advantages of a BindableRun. The purpose of this example was to show a scenario when one would like data bound content in the midst of static content. Imagine a report where each page has a footer which reads, “this is the ___ page of this report.” In previous versions of the framework, the only way to do this would be to use a databound TextBlock. If the stars are aligned and the space provided for your footer is perfect, the text spacing may come out correct. In the majority of cases, due to the behavior of TextBlock and Run, the &amp;nbsp; output will look very bad. The correct way to accomplish this would to be use three runs where one is databound. This is now possible in WPF4. I have included updated sample code so that you can play with it and see some of the spacing issues I briefly mentioned. &lt;/p&gt;
&lt;p&gt;&amp;lt;Window x:Class=&amp;quot;TextBlogDWriteDemo.Window1&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlns=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlns:x=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;"&gt;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Title=&amp;quot;Window1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Window.Resources&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBox x:Key=&amp;quot;DataStore1&amp;quot; Text=&amp;quot;how text does not&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flow correctly&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBox x:Key=&amp;quot;DataStore2&amp;quot; Text=&amp;quot;This is an example&lt;/p&gt;
&lt;p&gt; &amp;nbsp;of how text flows correctly when only&lt;/p&gt;
&lt;p&gt; &amp;nbsp;using bound Runs&amp;quot;/&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBox x:Key=&amp;quot;DataStore3&amp;quot; Text=&amp;quot;how text flows correctly&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/Window.Resources&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;FlowDocument&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Paragraph&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Run Text=&amp;quot;This is an example of&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBlock Text=&amp;quot;{Binding Source=&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {StaticResource DataStore1},&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Path=Text}&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Run Text=&amp;quot;when using a combination of Runs&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and TextBlock&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Paragraph&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Paragraph&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Run Text=&amp;quot;This is an example of&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Run Text=&amp;quot;{Binding Source={StaticResource&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataStore3}, Path=Text}&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Run Text=&amp;quot;when using a combination of Runs and TextBlock&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Paragraph&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/FlowDocument&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/Window&amp;gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9995432" width="1" height="1"&gt;</description></item><item><title>re: Bindable Run</title><link>http://blogs.msdn.com/b/text/archive/2009/09/01/bindable-run.aspx#9994614</link><pubDate>Mon, 12 Apr 2010 19:32:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9994614</guid><dc:creator>PO</dc:creator><description>&lt;p&gt;The first paragraph in the sample shows a space justification. Who does the line breaking, &amp;lt;Run/&amp;gt; or &amp;lt;TextBlock/&amp;gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9994614" width="1" height="1"&gt;</description></item><item><title>re: Bindable Run</title><link>http://blogs.msdn.com/b/text/archive/2009/09/01/bindable-run.aspx#9914007</link><pubDate>Wed, 28 Oct 2009 10:27:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9914007</guid><dc:creator>Cole</dc:creator><description>&lt;p&gt;This is great news. &amp;nbsp;I ended up resorting to 'binding' with xslt for FlowDocument stuff previously so this is a huge improvement. &amp;nbsp;Thanks for listening to your customers on this one!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914007" width="1" height="1"&gt;</description></item><item><title>re: Bindable Run</title><link>http://blogs.msdn.com/b/text/archive/2009/09/01/bindable-run.aspx#9913753</link><pubDate>Tue, 27 Oct 2009 22:09:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913753</guid><dc:creator>Joe White</dc:creator><description>&lt;p&gt;Sweet! I never liked having to dig out the homebrew code whenever I start playing around with a new project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913753" width="1" height="1"&gt;</description></item></channel></rss>