Marquee / Scrolling Text<font size=3><span style="font-family:Garamond,Times,Serif">Hi,</span><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Is it possible to create a marque or scrolling text in WPF. One approach I can think of is by using timers and doing it programatically. Is there any other approach?</span><br style="font-family:Garamond,Times,Serif"><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Thanks</span><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Sai</span><br style="font-family:Garamond,Times,Serif"></font>© 2009 Microsoft Corporation. All rights reserved.Mon, 16 Nov 2009 18:34:35 Z7a391faa-8607-4c2b-84d4-4ee3bf55a679http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#7a391faa-8607-4c2b-84d4-4ee3bf55a679http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#7a391faa-8607-4c2b-84d4-4ee3bf55a679Sai Ahttp://social.msdn.microsoft.com/Profile/en-US/?user=Sai%20AMarquee / Scrolling Text<font size=3><span style="font-family:Garamond,Times,Serif">Hi,</span><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Is it possible to create a marque or scrolling text in WPF. One approach I can think of is by using timers and doing it programatically. Is there any other approach?</span><br style="font-family:Garamond,Times,Serif"><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Thanks</span><br style="font-family:Garamond,Times,Serif"><span style="font-family:Garamond,Times,Serif">Sai</span><br style="font-family:Garamond,Times,Serif"></font>Mon, 30 Oct 2006 07:07:16 Z2006-11-01T01:59:44Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#35051507-692e-4b28-a01f-5e1abc907e6chttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#35051507-692e-4b28-a01f-5e1abc907e6cDouglas Stockwellhttp://social.msdn.microsoft.com/Profile/en-US/?user=Douglas%20StockwellMarquee / Scrolling Text<P>You can use animations. Here's an example:</P> <P>However, the hardcoded Width and From/To&nbsp;may pose a problem. Depending on where this is used, you can probably work around this by applying bindings on the inital TranslateTrasform.X and the To of the DoubleAnimation.</P><PRE style="FONT-SIZE: 12px; FONT-FAMILY: consolas"><SPAN style="COLOR: rgb(0,0,255)">&lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">Page</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">xmlns</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">http://schemas.microsoft.com/winfx/2006/xaml/presentation</SPAN>" <SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">xmlns:x</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">http://schemas.microsoft.com/winfx/2006/xaml</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">Grid</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">Width</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">300</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">ClipToBounds</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">True</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock.RenderTransform</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">TranslateTransform</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">x:Name</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">translate</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> /&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock.RenderTransform</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock.Triggers</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">EventTrigger</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">RoutedEvent</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">FrameworkElement.Loaded</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">BeginStoryboard</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">Storyboard</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">RepeatBehavior</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">Forever</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;</SPAN><SPAN style="COLOR: rgb(128,0,0)">DoubleAnimation</SPAN><SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">From</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">300</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">To</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">-300</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">Storyboard.TargetName</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">translate</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">Storyboard.TargetProperty</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">X</SPAN>" <SPAN style="COLOR: rgb(0,0,255)"> </SPAN><SPAN style="COLOR: rgb(255,0,0)">Duration</SPAN><SPAN style="COLOR: rgb(0,0,255)">=</SPAN>"<SPAN style="COLOR: rgb(0,0,255)">0:0:5</SPAN>"<SPAN style="COLOR: rgb(0,0,255)"> /&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">Storyboard</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">BeginStoryboard</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">EventTrigger</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock.Triggers</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; </SPAN> Is it possible to create a marque or scrolling text in WPF? <SPAN style="COLOR: rgb(0,0,255)"> &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">TextBlock</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">Grid</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt; &lt;/</SPAN><SPAN style="COLOR: rgb(128,0,0)">Page</SPAN><SPAN style="COLOR: rgb(0,0,255)">&gt;</SPAN></PRE> <P>- Doug</P>Mon, 30 Oct 2006 08:24:26 Z2006-10-30T08:34:03Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#014c2256-14f4-47e2-bf06-0053e2806477http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#014c2256-14f4-47e2-bf06-0053e2806477paukp06http://social.msdn.microsoft.com/Profile/en-US/?user=paukp06Marquee / Scrolling TextI need to change hardcoded Width and From/To at code behind. I need to create a lot of text to display like news ticker. Is it possible to create in code behind?Tue, 31 Oct 2006 23:20:07 Z2006-10-31T23:20:07Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#27b5b451-536d-4567-8681-0a5353eb54f7http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#27b5b451-536d-4567-8681-0a5353eb54f7LesterLobo - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=LesterLobo%20-%20MSFTMarquee / Scrolling Text<p>yeah, check out the double animation topic in the SDK.... it should provide some sample code.</p> <p>HTH</p>Wed, 01 Nov 2006 01:59:38 Z2006-11-01T01:59:44Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#5e6301e7-05f5-4848-bb18-94d766edcb7ehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#5e6301e7-05f5-4848-bb18-94d766edcb7eJoao Sousahttp://social.msdn.microsoft.com/Profile/en-US/?user=Joao%20SousaMarquee / Scrolling Text<p>I have a textbox with rss feeds and i need to create some animation so that the text is always srolling, i need some help on how to do that. The textbox lenght must be dynamic...</p> <p>Thanks</p>Wed, 21 Mar 2007 14:23:39 Z2007-03-21T14:23:39Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#efe904cc-dee1-4940-8a68-d76a853c1c7bhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#efe904cc-dee1-4940-8a68-d76a853c1c7bIshmaelhttp://social.msdn.microsoft.com/Profile/en-US/?user=IshmaelMarquee / Scrolling TextI used the above code, but if i increase the size of the font or change the text to a bigger text, when animating it always clips the textbox. why?Tue, 27 Mar 2007 12:18:17 Z2007-03-27T12:18:17Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#e1c3397e-fa01-4958-b6d3-b7fa76fc3447http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#e1c3397e-fa01-4958-b6d3-b7fa76fc3447Douglas Stockwellhttp://social.msdn.microsoft.com/Profile/en-US/?user=Douglas%20StockwellMarquee / Scrolling Text<p>Ishmael: As I mentioned above the code uses fixed size values.</p> <p> </p> <p>Here's a more generic solution. This uses my JScriptConverter to make a few small calculations, the source is available here (<a title="http://11011.net/archives/000668.html" href="http://11011.net/archives/000668.html">http://11011.net/archives/000668.html</a>)</p><pre style="font-size:12px;font-family:consolas"><span style="color:rgb(0,0,255)">&lt;</span><span style="color:rgb(163,21,21)">Window</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">x:Class</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">Marquee.Window1</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">xmlns</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">xmlns:x</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">http://schemas.microsoft.com/winfx/2006/xaml</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">xmlns:utils</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">clr-namespace:Utils.Avalon</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Window.Resources</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">utils:JScriptConverter</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">x:Key</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">JScript</span>&quot;<span style="color:rgb(0,0,255)"> /&gt; &lt;</span><span style="color:rgb(163,21,21)">ControlTemplate</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">TargetType</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">ContentControl</span>&quot;<span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">x:Key</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">Marquee</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Canvas</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ClipToBounds</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">True</span>&quot;<span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Name</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">container</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Grid</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Name</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">marquee</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Grid.RenderTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">TranslateTransform</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">x:Name</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">translate</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">TranslateTransform.X</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">MultiBinding</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Converter</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">{StaticResource JScript}</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ConverterParameter</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">values[0] + values[1]</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Binding</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ElementName</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">container</span>&quot;<span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Path</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">ActualWidth</span>&quot;<span style="color:rgb(0,0,255)"> /&gt; &lt;</span><span style="color:rgb(163,21,21)">Binding</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ElementName</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">content</span>&quot;<span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Path</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">ActualWidth</span>&quot;<span style="color:rgb(0,0,255)"> /&gt; &lt;/</span><span style="color:rgb(163,21,21)">MultiBinding</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">TranslateTransform.X</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">TranslateTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">Grid.RenderTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">ContentPresenter</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Name</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">content</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">ContentPresenter.RenderTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">TranslateTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">TranslateTransform.X</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Binding</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Path</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">ActualWidth</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ElementName</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">content</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Converter</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">{StaticResource JScript}</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">ConverterParameter</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">-values[0]</span>&quot;<span style="color:rgb(0,0,255)"> /&gt; &lt;/</span><span style="color:rgb(163,21,21)">TranslateTransform.X</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">TranslateTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">ContentPresenter.RenderTransform</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">ContentPresenter</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">Grid</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">Canvas</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">ControlTemplate.Triggers</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">EventTrigger</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">RoutedEvent</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">FrameworkElement.Loaded</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">BeginStoryboard</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">Storyboard</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">RepeatBehavior</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">Forever</span>&quot;<span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">DoubleAnimation</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">To</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">0</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Storyboard.TargetName</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">translate</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Storyboard.TargetProperty</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">X</span>&quot; <span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Duration</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">0:0:5</span>&quot;<span style="color:rgb(0,0,255)"> /&gt; &lt;/</span><span style="color:rgb(163,21,21)">Storyboard</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">BeginStoryboard</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">EventTrigger</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">ControlTemplate.Triggers</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">ControlTemplate</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">Window.Resources</span><span style="color:rgb(0,0,255)">&gt; &lt;</span><span style="color:rgb(163,21,21)">ContentControl</span><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(255,0,0)">Template</span><span style="color:rgb(0,0,255)">=</span>&quot;<span style="color:rgb(0,0,255)">{StaticResource Marquee}</span>&quot;<span style="color:rgb(0,0,255)">&gt; </span>Is it possible to create a marque or scrolling text in WPF?<span style="color:rgb(0,0,255)"> &lt;/</span><span style="color:rgb(163,21,21)">ContentControl</span><span style="color:rgb(0,0,255)">&gt; &lt;/</span><span style="color:rgb(163,21,21)">Window</span><span style="color:rgb(0,0,255)">&gt;</span></pre>Wed, 28 Mar 2007 12:10:11 Z2007-03-28T12:10:11Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#cd4a049e-3461-4b2e-8a68-6e4b2877298ehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#cd4a049e-3461-4b2e-8a68-6e4b2877298eIshmaelhttp://social.msdn.microsoft.com/Profile/en-US/?user=IshmaelMarquee / Scrolling TextWhen i try to use that code and the jscriptconverter, blend tells me it can't create an instance of jscriptconverter. odd that because all the namespace are correct.Wed, 28 Mar 2007 17:01:12 Z2007-03-28T17:01:12Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#74432e98-a645-4bdd-8704-1600546aa911http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#74432e98-a645-4bdd-8704-1600546aa911Juan1111111111http://social.msdn.microsoft.com/Profile/en-US/?user=Juan1111111111Marquee / Scrolling Text<p align=left><font face=Arial size=2></font> </p> <p>I am having the same problem, we need your help!!! </p> <p align=left> </p> <p align=left>I have the JScriptConverter.cs inside of a project named util. In another project, named Marquesina, I have the xaml code. Both, inside the same solution. </p> <p align=left> </p> <p align=left>I am trying to instanciate the JScriptConverter class in the XAML, and I can`t.</p> <p align=left> </p> <p align=left>Here is the code that I am using:</p> <p align=left> </p><font color="#0000ff" size=2> <p>&lt;</font><font color="#800000" size=2>Window</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>x:Class</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Marquesina.Window1</font><font size=2>&quot;</p></font><font color="#0000ff" size=2> <p></font><font color="#ff0000" size=2>xmlns</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>http://schemas.microsoft.com/winfx/2006/xaml/presentation</font><font size=2>&quot;</p></font><font color="#0000ff" size=2> <p></font><font color="#ff0000" size=2>xmlns:x</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>http://schemas.microsoft.com/winfx/2006/xaml</font><font size=2>&quot;</p></font><font color="#0000ff" size=2> <p></font><font color="#ff0000" size=2>xmlns:utils</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>util</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p></p> <p> </p> <p>&lt;</font><font color="#800000" size=2>Window.Resources</font><font color="#0000ff" size=2>&gt;</p> <p>&lt;</font><font color="#800000" size=2>utils:JScriptConverter</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>x:Key</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>JScript</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p> <p>&lt;</font><font color="#800000" size=2>ControlTemplate</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>TargetType</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>ContentControl</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>x:Key</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Marquee</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p>&lt;</font><font color="#800000" size=2>Canvas</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>ClipToBounds</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>True</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Name</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>container</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p>&lt;</font><font color="#800000" size=2>Grid</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Name</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>marquee</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p> </p> <p align=left>Do you know what am I doing wrong?</p> <p align=left>It is very important that you answer me, I need it asap.</p> <p align=left> </p> <p align=left>Bye, and many thanks.</p> <p align=left>Juan</font></p>Thu, 15 Nov 2007 22:45:59 Z2007-11-15T22:45:59Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#1c639150-4a33-4456-9bb1-add3a4eabc28http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#1c639150-4a33-4456-9bb1-add3a4eabc28Matt Galbraith - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Matt%20Galbraith%20-%20MSFTMarquee / Scrolling Text<p align=left><font face=Arial size=2>Great examples guys, but none of these are usable (even ignoring hard coded width issues) for a real headline scenario.  Just try either of the XAML snippets above and make the text 2 or 3 times as long and you'll see the clipping problem.</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>Does anyone know how to make this work when the text is wider than the grid?  The content is automagically clipped to exactly the ActualWidth of the grid.  For a true headline scenario, this isn't very useful... at least on CNN the marquees are routinely much longer than the screen width for a single headline.</font></p> <p align=left> </p> <p align=left>I've got this working by animating the Canvas.Left property, since Canvas has no such limitations... as the Left property changes, layout updates and thus changes the text width appropriately.  </p> <p align=left> </p> <p align=left>(Other thread about this is here: <a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2475074&amp;SiteID=1&amp;mode=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2475074&amp;SiteID=1&amp;mode=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2475074&amp;SiteID=1&amp;mode=1</a> )</p>Wed, 28 Nov 2007 18:38:58 Z2007-11-28T18:38:58Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#bdfaf9b7-a6e8-4f0a-8e03-3a5bd190c505http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#bdfaf9b7-a6e8-4f0a-8e03-3a5bd190c505Fanou360http://social.msdn.microsoft.com/Profile/en-US/?user=Fanou360Marquee / Scrolling TextSomeone found an elegant solution to display text *** news feed dinamicly and with no hard coded width ?<br>Sat, 08 Dec 2007 17:24:10 Z2007-12-08T17:24:10Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#c7efd9d3-6b57-4e30-aaee-eea828115697http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#c7efd9d3-6b57-4e30-aaee-eea828115697Patriziohttp://social.msdn.microsoft.com/Profile/en-US/?user=PatrizioMarquee / Scrolling Text This is not a finished code, but my first attempt to make a marquee with WPF ...<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;width:80%;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">Window x:</font><font style="color:red">Class</font><font style="font-size:11px">=</font><font style="color:blue">&quot;IUCliente&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">    </font><font style="color:red">xmlns</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>    xmlns:</font><font style="color:red">x</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">    </font><font style="color:red">Title</font><font style="font-size:11px">=</font><font style="color:blue">&quot;IUCliente&quot;</font><font style="font-size:11px"> </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;600&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;800&quot;</font><font style="font-size:11px"> </font><font style="color:red">Background</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Black&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td>    </font><font style="color:blue">&lt;</font><font style="font-size:11px">Grid</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">&lt;</font><font style="font-size:11px">Grid.RowDefinitions</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RowDefinition </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;24*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RowDefinition </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;120*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RowDefinition </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;268*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RowDefinition </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;94*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RowDefinition </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;56*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Grid.RowDefinitions</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>        </font><font style="color:blue">&lt;</font><font style="font-size:11px">Grid.ColumnDefinitions</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">ColumnDefinition </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;572*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">ColumnDefinition </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;160*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">ColumnDefinition </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;46*&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>        </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Grid.ColumnDefinitions</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>        </font><font style="color:blue">&lt;</font><font style="font-size:11px">Viewbox </font><font style="color:red">Grid.Row</font><font style="font-size:11px">=</font><font style="color:blue">&quot;3&quot;</font><font style="font-size:11px"> </font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Viewbox1&quot;</font><font style="font-size:11px"> </font><font style="color:red">Stretch</font><font style="font-size:11px">=</font><font style="color:blue">&quot;UniformToFill&quot;</font><font style="font-size:11px"> </font><font style="color:red">StretchDirection</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Both&quot;</font><font style="font-size:11px"> </font><font style="color:red">Grid.ColumnSpan</font><font style="font-size:11px">=</font><font style="color:blue">&quot;3&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">TextBlock  </font><font style="color:red">HorizontalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Left&quot;</font><font style="font-size:11px"> </font><font style="color:red">Margin</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0,0,0,0&quot;</font><font style="font-size:11px"> </font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;TextBlock1&quot;</font><font style="font-size:11px"> </font><font style="color:red">Text</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Este es un texto muy pero muy pero muy largo&quot;</font><font style="font-size:11px"> </font><font style="color:red">FontFamily</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Calibri&quot;</font><font style="font-size:11px"> </font><font style="color:red">FontSize</font><font style="font-size:11px">=</font><font style="color:blue">&quot;20&quot;</font><font style="font-size:11px"> </font><font style="color:red">Background</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Black&quot;</font><font style="font-size:11px"> </font><font style="color:red">Foreground</font><font style="font-size:11px">=</font><font style="color:blue">&quot;AntiqueWhite&quot;</font><font style="font-size:11px"> </font><font style="color:red">VerticalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Center&quot;</font><font style="font-size:11px"> </font><font style="color:red">TextWrapping</font><font style="font-size:11px">=</font><font style="color:blue">&quot;NoWrap&quot;</font><font style="font-size:11px">&gt;</font><font style="color:blue">&lt;/</font><font style="font-size:11px">TextBlock</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>        </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Viewbox</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">          </td></tr> <tr> <td>    </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Grid</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7"></font><font style="color:blue">&lt;/</font><font style="font-size:11px">Window</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td> </td></tr></tbody></table></div><br>And the code in VB that start de animations is this one, you can bind it to a button or another event ...<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;width:80%;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px">        </font><font style="color:blue">Dim</font><font style="font-size:11px"> lp </font><font style="color:blue">As</font><font style="font-size:11px"> </font><font style="color:blue">Double</font><font style="font-size:11px"> = TextBlock1.ActualWidth  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">Dim</font><font style="font-size:11px"> da </font><font style="color:blue">As</font><font style="font-size:11px"> </font><font style="color:blue">New</font><font style="font-size:11px"> Windows.Media.Animation.ThicknessAnimation  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">        da.Duration = </font><font style="color:blue">New</font><font style="font-size:11px"> Duration(TimeSpan.Parse(</font><font style="color:blue">&quot;0:0:25&quot;</font><font style="font-size:11px">))  </font></td></tr> <tr> <td>        da.From = </font><font style="color:blue">New</font><font style="font-size:11px"> Thickness(lp, 0, -lp, 0)  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        da.</font><font style="color:blue">To</font><font style="font-size:11px"> = </font><font style="color:blue">New</font><font style="font-size:11px"> Thickness(-lp, 0, lp, 0)  </font></td></tr> <tr> <td>        da.RepeatBehavior = Windows.Media.Animation.RepeatBehavior.Forever  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>        TextBlock1.BeginAnimation(TextBlock.MarginProperty, da) </td></tr></tbody></table></div><br><br>I hope this will help you find a way to construct a marquee the way you want<br>Mon, 07 Jul 2008 15:55:36 Z2008-07-07T16:03:41Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#ce35df42-d9a6-4f3f-84ae-185cb1d2ad50http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#ce35df42-d9a6-4f3f-84ae-185cb1d2ad50BalaMurugan_Sahttp://social.msdn.microsoft.com/Profile/en-US/?user=BalaMurugan_SaMarquee / Scrolling Text Hey guys,<br><br>Check this link.. I have tried in a different way...<br><br><a href="http://forums.expression.microsoft.com/en-US/blend/thread/8fd03c38-438a-44fa-9845-067131041b63">http://forums.expression.microsoft.com/en-US/blend/thread/8fd03c38-438a-44fa-9845-067131041b63</a><br><br>-BALA.<br>Mon, 01 Sep 2008 13:46:02 Z2008-09-01T13:46:02Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#f2ddc346-dbe0-441e-927c-a5de0df86756http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#f2ddc346-dbe0-441e-927c-a5de0df86756philipshhttp://social.msdn.microsoft.com/Profile/en-US/?user=philipshMarquee / Scrolling Text Here's a solution I came up with.  You basically animate the TranslateTransform of a textblock on a canvas.  The timing is basically y=mx+b stuff (fromSecValue = equSlope * textSize + offSetY) to account for the fact that longer text needs to be given more time to traverse a longer distance.  I've tested it with text up to around 500 chars in length.  Seems to work well and the scroll is very smooth.  Below is the Xaml and at bottom is the code behind. <br><br> <p> </p> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">Window x:</font><font style="color:red">Class</font><font style="font-size:11px">=</font><font style="color:blue">&quot;transforms.Window2&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">    </font><font style="color:red">xmlns</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>    xmlns:</font><font style="color:red">x</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">    </font><font style="color:red">Title</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Window2&quot;</font><font style="font-size:11px"> </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;672&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;807&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td>    </font><font style="color:blue">&lt;</font><font style="font-size:11px">Grid </font><font style="color:red">Background</font><font style="font-size:11px">=</font><font style="color:blue">&quot;DarkGray&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">&lt;</font><font style="font-size:11px">Canvas </font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;canvas1&quot;</font><font style="font-size:11px"> </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;32&quot;</font><font style="font-size:11px"> </font><font style="color:red">ClipToBounds</font><font style="font-size:11px">=</font><font style="color:blue">&quot;True&quot;</font><font style="font-size:11px"> </font><font style="color:red">HorizontalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Left&quot;</font><font style="font-size:11px"> </font><font style="color:red">VerticalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Bottom&quot;</font><font style="font-size:11px"> </font><font style="color:red">Background</font><font style="font-size:11px">=</font><font style="color:blue">&quot;White&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;500&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">TextBlock </font><font style="color:red">Canvas.Left</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> </font><font style="color:red">Canvas.Top</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;31&quot;</font><font style="font-size:11px"> </font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;textBlock1&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;219&quot;</font><font style="font-size:11px"> </font><font style="color:red">Text</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Have a nice day!&quot;</font><font style="font-size:11px"> </font><font style="color:red">FontSize</font><font style="font-size:11px">=</font><font style="color:blue">&quot;18.6666666666667&quot;</font><font style="font-size:11px"> </font><font style="color:red">TextWrapping</font><font style="font-size:11px">=</font><font style="color:blue">&quot;NoWrap&quot;</font><font style="font-size:11px"> </font><font style="color:red">VerticalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Center&quot;</font><font style="font-size:11px">&gt;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">                 </font><font style="color:blue">&lt;</font><font style="font-size:11px">TextBlock.RenderTransform</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>           </font><font style="color:blue">&lt;</font><font style="font-size:11px">TransformGroup</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">ScaleTransform </font><font style="color:red">ScaleX</font><font style="font-size:11px">=</font><font style="color:blue">&quot;1&quot;</font><font style="font-size:11px"> </font><font style="color:red">ScaleY</font><font style="font-size:11px">=</font><font style="color:blue">&quot;1&quot;</font><font style="font-size:11px">/&gt;  </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">SkewTransform </font><font style="color:red">AngleX</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> </font><font style="color:red">AngleY</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px">/&gt;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">&lt;</font><font style="font-size:11px">RotateTransform </font><font style="color:red">Angle</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px">/&gt;  </font></td></tr> <tr> <td>            </font><font style="color:blue">&lt;</font><font style="font-size:11px">TranslateTransform x:</font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;rtTTransform&quot;</font><font style="font-size:11px">/&gt;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">           </font><font style="color:blue">&lt;/</font><font style="font-size:11px">TransformGroup</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>          </font><font style="color:blue">&lt;/</font><font style="font-size:11px">TextBlock.RenderTransform</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">         </font><font style="color:blue">&lt;/</font><font style="font-size:11px">TextBlock</font><font style="color:blue">&gt;</font><font style="font-size:11px">          </font></td></tr> <tr> <td>        </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Canvas</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">&lt;</font><font style="font-size:11px">Button </font><font style="color:red">Margin</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0,0,53,102.861&quot;</font><font style="font-size:11px"> </font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;button1&quot;</font><font style="font-size:11px"> </font><font style="color:red">Click</font><font style="font-size:11px">=</font><font style="color:blue">&quot;button1_Click&quot;</font><font style="font-size:11px"> </font><font style="color:red">Height</font><font style="font-size:11px">=</font><font style="color:blue">&quot;88&quot;</font><font style="font-size:11px"> </font><font style="color:red">VerticalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Bottom&quot;</font><font style="font-size:11px"> </font><font style="color:red">HorizontalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Right&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;244&quot;</font><font style="font-size:11px">&gt;Apply</font><font style="color:blue">&lt;/</font><font style="font-size:11px">Button</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td>    </font><font style="color:blue">&lt;/</font><font style="font-size:11px">Grid</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7"></font><font style="color:blue">&lt;/</font><font style="font-size:11px">Window</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr></tbody></table></div> <p> </p> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px"> </font><font style="color:blue">private</font><font style="font-size:11px"> </font><font style="color:blue">void</font><font style="font-size:11px"> button1_Click(</font><font style="color:blue">object</font><font style="font-size:11px"> sender, RoutedEventArgs e)  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        {  </td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">             </td></tr> <tr> <td>            </font><font style="color:blue">double</font><font style="font-size:11px"> textBoxWidth = 10;  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            </font><font style="color:blue">double</font><font style="font-size:11px"> pixelXFactor;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">double</font><font style="font-size:11px"> canvaswidth = </font><font style="color:blue">this</font><font style="font-size:11px">.canvas1.Width;  </font></td></tr> <tr> <td>            </font><font style="color:blue">double</font><font style="font-size:11px"> negXOffSet = 0;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">double</font><font style="font-size:11px"> fromSecValue = 0;  </font></td></tr> <tr> <td>            </font><font style="color:blue">string</font><font style="font-size:11px"> theText = </font><font style="color:blue">&quot;This is the text&quot;</font><font style="font-size:11px">;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">double</font><font style="font-size:11px"> equSlope = 0.022546419;  </font></td></tr> <tr> <td>            </font><font style="color:blue">double</font><font style="font-size:11px"> offSetY = 10.96286472;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">double</font><font style="font-size:11px"> stringSize;  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">int</font><font style="font-size:11px"> textLen = theText.Length;  </font></td></tr> <tr> <td>           </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            </font><font style="color:green">//Set the width of the text box according to the width (not length) of the text in it. </font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            System.Globalization.CultureInfo enUsCultureInfo;  </td></tr> <tr> <td style="background-color:#f7f7f7">            Typeface fontTF;  </td></tr> <tr> <td>            FormattedText frmmtText;  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            </font><font style="color:blue">if</font><font style="font-size:11px"> (textLen &gt; 0)  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            {  </td></tr> <tr> <td>                enUsCultureInfo = System.Globalization.CultureInfo.GetCultureInfo(</font><font style="color:blue">&quot;en-us&quot;</font><font style="font-size:11px">);  </font></td></tr> <tr> <td style="background-color:#f7f7f7">                fontTF = </font><font style="color:blue">new</font><font style="font-size:11px"> Typeface(</font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.FontFamily, </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.FontStyle, </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.FontWeight, </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.FontStretch);  </font></td></tr> <tr> <td>                frmmtText = </font><font style="color:blue">new</font><font style="font-size:11px"> FormattedText(theText, enUsCultureInfo, FlowDirection.LeftToRight, fontTF, </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.FontSize, </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.Foreground);  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>                stringSize = frmmtText.Width;  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>             </td></tr> <tr> <td style="background-color:#f7f7f7">                </font><font style="color:blue">if</font><font style="font-size:11px"> (stringSize &lt; 100)  </font></td></tr> <tr> <td>                    pixelXFactor = 1.02;  </td></tr> <tr> <td style="background-color:#f7f7f7">                </font><font style="color:blue">else</font><font style="font-size:11px"> </font></td></tr> <tr> <td>                    pixelXFactor = 1.01;  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>                textBoxWidth = stringSize * pixelXFactor;  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>                </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.Width = textBoxWidth;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">                negXOffSet = textBoxWidth * -1;        </td></tr> <tr> <td>                    </td></tr> <tr> <td style="background-color:#f7f7f7">                fromSecValue = (stringSize * equSlope) + offSetY;             </td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">                </font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1.Text = theText;  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">                Storyboard _sb = </font><font style="color:blue">new</font><font style="font-size:11px"> Storyboard();  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">                Duration durX = </font><font style="color:blue">new</font><font style="font-size:11px"> Duration(TimeSpan.FromSeconds(fromSecValue));  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">                DoubleAnimation daX = </font><font style="color:blue">new</font><font style="font-size:11px"> DoubleAnimation(canvaswidth, negXOffSet, durX);  </font></td></tr> <tr> <td>                daX.RepeatBehavior = RepeatBehavior.Forever;  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>                 </td></tr> <tr> <td style="background-color:#f7f7f7">                Storyboard.SetTargetName(daX, </font><font style="color:blue">&quot;rtTTransform&quot;</font><font style="font-size:11px">);  </font></td></tr> <tr> <td>                Storyboard.SetTargetProperty(daX, </font><font style="color:blue">new</font><font style="font-size:11px"> PropertyPath(TranslateTransform.XProperty));  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>                _sb.Children.Add(daX);  </td></tr> <tr> <td style="background-color:#f7f7f7">                _sb.Begin(</font><font style="color:blue">this</font><font style="font-size:11px">.textBlock1);  </font></td></tr> <tr> <td>            }  </td></tr> <tr> <td style="background-color:#f7f7f7">            </font><font style="color:blue">else</font><font style="font-size:11px"> </font></td></tr> <tr> <td>            {  </td></tr> <tr> <td style="background-color:#f7f7f7">                textBoxWidth = 1;  </td></tr> <tr> <td>                stringSize = 0;  </td></tr> <tr> <td style="background-color:#f7f7f7">            }             </td></tr> <tr> <td>        }  </td></tr> <tr> <td style="background-color:#f7f7f7">    }  </td></tr> <tr> <td>}  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr></tbody></table></div>Wed, 17 Sep 2008 15:06:16 Z2008-09-17T15:12:30Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#25b1a84f-90af-4c91-b6ac-7c3f9b6d8a72http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#25b1a84f-90af-4c91-b6ac-7c3f9b6d8a72Litterhttp://social.msdn.microsoft.com/Profile/en-US/?user=LitterMarquee / Scrolling TextGreat job!<br><br>Is it possible to update the text dynamically? For example via an RSS Feed?<br> Wed, 17 Sep 2008 20:45:30 Z2008-09-17T20:45:30Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#965c1345-f58c-44cb-b783-443ee7559c71http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#965c1345-f58c-44cb-b783-443ee7559c71HDWagnerhttp://social.msdn.microsoft.com/Profile/en-US/?user=HDWagnerMarquee / Scrolling TextDouglas, if you're still reading this ...<br> <br> Or all other WPF gods. I used Douglas Stockwells XAML-only solution with minor adjustments:<br> <br>    &lt;ControlTemplate TargetType=&quot;ContentControl&quot; x:Key=&quot;MarqueeContentControl&quot;&gt;<br><br>        &lt;Canvas ClipToBounds=&quot;True&quot; Name=&quot;container&quot;<br>                Height=&quot;{Binding ElementName=content, Path=ActualHeight, Mode=OneWay}&quot; &gt;<br>            &lt;Grid&gt;<br><br>                &lt;Grid.RenderTransform&gt;<br>                    &lt;TranslateTransform x:Name=&quot;marquee_translate&quot;&gt;<br>                        &lt;TranslateTransform.X&gt;<br>                            &lt;MultiBinding Converter=&quot;{StaticResource Add}&quot; Mode=&quot;OneWay&quot;&gt;<br>                                &lt;Binding ElementName=&quot;container&quot; Path=&quot;ActualWidth&quot; Mode=&quot;OneWay&quot; /&gt;<br>                                &lt;Binding ElementName=&quot;content&quot; Path=&quot;ActualWidth&quot; Mode=&quot;OneWay&quot; /&gt;<br>                            &lt;/MultiBinding&gt;<br>                        &lt;/TranslateTransform.X&gt;<br>                    &lt;/TranslateTransform&gt;<br>                &lt;/Grid.RenderTransform&gt;<br><br>                &lt;ContentPresenter Name=&quot;content&quot;&gt;<br>                    &lt;ContentPresenter.RenderTransform&gt;<br>                        &lt;TranslateTransform&gt;<br>                            &lt;TranslateTransform.X&gt;<br>                                &lt;MultiBinding Mode=&quot;OneWay&quot; Converter=&quot;{StaticResource Substract}&quot;&gt;<br>                                    &lt;Binding Mode=&quot;OneTime&quot;&gt;<br>                                        &lt;Binding.Source&gt;<br>                                            &lt;s:Double&gt;0&lt;/s:Double&gt;<br>                                        &lt;/Binding.Source&gt;<br>                                    &lt;/Binding&gt;<br>                                    &lt;Binding ElementName=&quot;content&quot; Path=&quot;ActualWidth&quot; Mode=&quot;OneWay&quot;/&gt;<br>                                &lt;/MultiBinding&gt;<br>                            &lt;/TranslateTransform.X&gt;<br>                        &lt;/TranslateTransform&gt;<br>                    &lt;/ContentPresenter.RenderTransform&gt;<br>                &lt;/ContentPresenter&gt;<br><br>            &lt;/Grid&gt;<br>        &lt;/Canvas&gt;<br><br>        &lt;ControlTemplate.Triggers&gt;<br>            &lt;EventTrigger RoutedEvent=&quot;FrameworkElement.Loaded&quot;&gt;<br>                &lt;BeginStoryboard&gt;<br>                    &lt;Storyboard RepeatBehavior=&quot;Forever&quot;&gt;<br>                        &lt;DoubleAnimation<br>                               To=&quot;0&quot;<br>                               Storyboard.TargetName=&quot;marquee_translate&quot;<br>                               Storyboard.TargetProperty=&quot;X&quot;<br>                               Duration=&quot;0:0:15&quot; /&gt;<br>                    &lt;/Storyboard&gt;<br>                &lt;/BeginStoryboard&gt;<br>            &lt;/EventTrigger&gt;<br>        &lt;/ControlTemplate.Triggers&gt;<br><br>    &lt;/ControlTemplate&gt;<br><br> <br> I use it like this in my code:<br><br><br>&lt;ContentControl Template=&quot;{DynamicResource MarqueeContentControl}&quot; VerticalAlignment=&quot;Bottom&quot;&gt;<br>   &lt;WPFUI:WPFLabel Style=&quot;{DynamicResource front-title-label-style}&quot; Caption=&quot;{Binding Path=Data.group_selected_caption}&quot; /&gt;<br>&lt;/ContentControl&gt;<br><br><br><br>Works like a charm. But only in about 75 percent of all cases. If I show a Window using this code, there's a certain chance that it crashes and I get the following exception (it translates to something like 'The name marquee-translate can't be found in the name scope of ControlTemplate'):<br><br><br> <br> System.InvalidOperationException: Der Name &quot;marquee_translate&quot; kann im Namensbereich von &quot;System.Windows.Controls.ControlTemplate&quot; nicht gefunden werden.<br>    bei System.Windows.Media.Animation.Storyboard.ResolveTargetName(String targetName, INameScope nameScope, DependencyObject element)<br>    bei System.Windows.Media.Animation.Storyboard.ClockTreeWalkRecursive(Clock currentClock, DependencyObject containingObject, INameScope nameScope, DependencyObject parentObject, String parentObjectName, PropertyPath parentPropertyPath, HandoffBehavior handoffBehavior, HybridDictionary clockMappings, Int64 layer)<br>    bei System.Windows.Media.Animation.Storyboard.ClockTreeWalkRecursive(Clock currentClock, DependencyObject containingObject, INameScope nameScope, DependencyObject parentObject, String parentObjectName, PropertyPath parentPropertyPath, HandoffBehavior handoffBehavior, HybridDictionary clockMappings, Int64 layer)<br>    bei System.Windows.Media.Animation.Storyboard.BeginCommon(DependencyObject containingObject, INameScope nameScope, HandoffBehavior handoffBehavior, Boolean isControllable, Int64 layer)<br>    bei System.Windows.Media.Animation.BeginStoryboard.Begin(DependencyObject targetObject, INameScope nameScope, Int64 layer)<br>    bei System.Windows.Media.Animation.BeginStoryboard.Invoke(FrameworkElement fe, FrameworkContentElement fce, Style targetStyle, FrameworkTemplate frameworkTemplate, Int64 layer)<br>    bei System.Windows.StyleHelper.InvokeEventTriggerActions(FrameworkElement fe, FrameworkContentElement fce, Style ownerStyle, FrameworkTemplate frameworkTemplate, Int32 childIndex, RoutedEvent Event)<br>    bei System.Windows.StyleHelper.ExecuteEventTriggerActionsOnContainer(Object sender, RoutedEventArgs e)<br>    bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)<br>    bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)<br> ...<br> <br> Okay. The Storyboard can't find the TranslateTransform which is defined some lines before. How can this happen? And even more imprtant: How can I avoid this?<br> Sun, 05 Oct 2008 16:47:20 Z2008-10-05T16:49:42Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#7e2063d3-9a28-49bf-91c7-b9d88a87b02ahttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#7e2063d3-9a28-49bf-91c7-b9d88a87b02aIlya Bernexhttp://social.msdn.microsoft.com/Profile/en-US/?user=Ilya%20BernexMarquee / Scrolling Text<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">UserControl x:</font><font style="color:red">Class</font><font style="font-size:11px">=</font><font style="color:blue">&quot;WpfApplication1.AniLabelControl&quot;</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">    <font style="color:red">xmlns</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</font><font style="font-size:11px"> </font></td></tr><tr><td>    xmlns:<font style="color:red">x</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</font><font style="font-size:11px"> </font><font style="color:red">Width</font><font style="font-size:11px">=</font><font style="color:blue">&quot;317&quot;</font><font style="font-size:11px">&gt; </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">    <font style="color:blue">&lt;</font><font style="font-size:11px">Canvas x:</font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;canvas1&quot;</font><font style="font-size:11px"> </font><font style="color:red">ClipToBounds</font><font style="font-size:11px">=</font><font style="color:blue">&quot;True&quot;</font><font style="font-size:11px"> </font><font style="color:red">Background</font><font style="font-size:11px">=</font><font style="color:blue">&quot;White&quot;</font><font style="font-size:11px">&gt; </font></td></tr><tr><td>        <font style="color:blue">&lt;</font><font style="font-size:11px">TextBlock </font><font style="color:red">Canvas.Left</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> </font><font style="color:red">Canvas.Top</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> x:</font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;textBlock1&quot;</font><font style="font-size:11px"> </font><font style="color:red">TextWrapping</font><font style="font-size:11px">=</font><font style="color:blue">&quot;NoWrap&quot;</font><font style="font-size:11px"> </font><font style="color:red">VerticalAlignment</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Center&quot;</font><font style="font-size:11px">&gt;   </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">            <font style="color:blue">&lt;</font><font style="font-size:11px">TextBlock.RenderTransform</font><font style="color:blue">&gt;</font><font style="font-size:11px">  </font></td></tr><tr><td>                <font style="color:blue">&lt;</font><font style="font-size:11px">TransformGroup</font><font style="color:blue">&gt;</font><font style="font-size:11px">  </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">                    <font style="color:blue">&lt;</font><font style="font-size:11px">ScaleTransform </font><font style="color:red">ScaleX</font><font style="font-size:11px">=</font><font style="color:blue">&quot;1&quot;</font><font style="font-size:11px"> </font><font style="color:red">ScaleY</font><font style="font-size:11px">=</font><font style="color:blue">&quot;1&quot;</font><font style="font-size:11px">/&gt;   </font></td></tr><tr><td>                    <font style="color:blue">&lt;</font><font style="font-size:11px">SkewTransform </font><font style="color:red">AngleX</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px"> </font><font style="color:red">AngleY</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px">/&gt;   </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">                    <font style="color:blue">&lt;</font><font style="font-size:11px">RotateTransform </font><font style="color:red">Angle</font><font style="font-size:11px">=</font><font style="color:blue">&quot;0&quot;</font><font style="font-size:11px">/&gt;   </font></td></tr><tr><td>                    <font style="color:blue">&lt;</font><font style="font-size:11px">TranslateTransform x:</font><font style="color:red">Name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;rtTTransform&quot;</font><font style="font-size:11px">/&gt;   </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">                <font style="color:blue">&lt;/</font><font style="font-size:11px">TransformGroup</font><font style="color:blue">&gt;</font><font style="font-size:11px">  </font></td></tr><tr><td>            <font style="color:blue">&lt;/</font><font style="font-size:11px">TextBlock.RenderTransform</font><font style="color:blue">&gt;</font><font style="font-size:11px">  </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">        <font style="color:blue">&lt;/</font><font style="font-size:11px">TextBlock</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr><tr><td>    <font style="color:blue">&lt;/</font><font style="font-size:11px">Canvas</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)"><font style="color:blue">&lt;/</font><font style="font-size:11px">UserControl</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr><tr><td> </td></tr></tbody></table></div><br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px">namespace WpfApplication1 </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">{ </td></tr><tr><td>    public partial class AniLabelControl : UserControl </td></tr><tr><td style="background-color:rgb(247, 247, 247)">    { </td></tr><tr><td>        #region Control Properties </td></tr><tr><td style="background-color:rgb(247, 247, 247)">        public string Text </td></tr><tr><td>        { </td></tr><tr><td style="background-color:rgb(247, 247, 247)">            get { return this.textBlock1.Text; } </td></tr><tr><td>            set { <font style="color:red">this.textBlock1.Text</font><font style="font-size:11px"> = </font><font style="color:blue">value</font><font style="font-size:11px">; } </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">        } </td></tr><tr><td>        #endregion </td></tr><tr><td style="background-color:rgb(247, 247, 247)"> </td></tr><tr><td>        Storyboard <font style="color:red">_sb</font><font style="font-size:11px"> = </font><font style="color:blue">new</font><font style="font-size:11px"> Storyboard(); </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">        public AniLabelControl() </td></tr><tr><td>        { </td></tr><tr><td style="background-color:rgb(247, 247, 247)">            InitializeComponent(); </td></tr><tr><td>             </td></tr><tr><td style="background-color:rgb(247, 247, 247)">        } </td></tr><tr><td>        protected override void  OnRenderSizeChanged(SizeChangedInfo sizeInfo) </td></tr><tr><td style="background-color:rgb(247, 247, 247)">        { </td></tr><tr><td>         base.OnRenderSizeChanged(sizeInfo); </td></tr><tr><td style="background-color:rgb(247, 247, 247)">             StartAnim(); </td></tr><tr><td>        } </td></tr><tr><td style="background-color:rgb(247, 247, 247)">        private void StartAnim() </td></tr><tr><td>        { </td></tr><tr><td style="background-color:rgb(247, 247, 247)">            if (this.textBlock1.ActualWidth <font style="color:blue">&lt;</font><font style="font-size:11px"> </font><font style="color:black;font-weight:bold">canvas1.ActualWidth</font><font style="font-size:11px">) return; </font></td></tr><tr><td>            Duration <font style="color:red">durX</font><font style="font-size:11px"> = </font><font style="color:blue">new</font><font style="font-size:11px"> Duration(TimeSpan.FromSeconds(this.textBlock1.ActualWidth / 60)); </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">            DoubleAnimation <font style="color:red">daX</font><font style="font-size:11px"> = </font><font style="color:blue">new</font><font style="font-size:11px"> DoubleAnimation(0, canvas1.ActualWidth - this.textBlock1.ActualWidth, durX); </font></td></tr><tr><td>            <font style="color:red">daX.RepeatBehavior</font><font style="font-size:11px"> = RepeatBehavior.Forever; </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">            Storyboard.SetTargetName(daX, &quot;rtTTransform&quot;); </td></tr><tr><td>            <font style="color:red">daX.AutoReverse</font><font style="font-size:11px"> = </font><font style="color:blue">true</font><font style="font-size:11px">; </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">            <font style="color:red">daX.AccelerationRatio</font><font style="font-size:11px"> = (double)0.9; </font></td></tr><tr><td>            Storyboard.SetTargetProperty(daX, new PropertyPath(TranslateTransform.XProperty)); </td></tr><tr><td style="background-color:rgb(247, 247, 247)">             </td></tr><tr><td>            _sb.Children.Add(daX); </td></tr><tr><td style="background-color:rgb(247, 247, 247)">            _sb.Begin(this.textBlock1); </td></tr><tr><td>        } </td></tr><tr><td style="background-color:rgb(247, 247, 247)">    } </td></tr><tr><td>} </td></tr></tbody></table></div><br>My version )))<br><br><br> Fri, 21 Nov 2008 18:39:17 Z2008-11-21T18:39:17Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#3c50b977-90ff-4433-8c5b-e3d50ab9749fhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#3c50b977-90ff-4433-8c5b-e3d50ab9749fRazanhttp://social.msdn.microsoft.com/Profile/en-US/?user=RazanMarquee / Scrolling TextYou will find the solution of your problem at <a href="http://weblogs.asp.net/razan/archive/2009/10/01/creating-marquee-scrolling-text-in-wpf.aspx">http://weblogs.asp.net/razan/archive/2009/10/01/creating-marquee-scrolling-text-in-wpf.aspx</a> <hr class=sig> RazanFri, 07 Aug 2009 08:19:17 Z2009-10-25T07:04:59Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#78d19537-d561-4f9c-a67a-d169c349e02chttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679#78d19537-d561-4f9c-a67a-d169c349e02cJorgeMiralleshttp://social.msdn.microsoft.com/Profile/en-US/?user=JorgeMirallesMarquee / Scrolling TextHello <span class=author><span class=name>Philipsh<br/> <br/> I'm using your code to make a marquee text, but some times works smooth and sometimes jumpy, what can be wrong? I would like a smooth animation always.<br/> <br/> Thanks<br/> Jorge<br/> </span> </span> <br/> <a class=author title="About philipsh" rel=nofollow href="../../../../Profile/en-US/?user=philipsh&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a391faa-8607-4c2b-84d4-4ee3bf55a679?prof%3drequired&amp;rh=6WBoPc1n0NK4u7ZDIWP7CEpHw2j4rEvZcU1sTEY1%2bXE%3d&amp;sp=forums" title="About philipsh" class=author> </a>Mon, 16 Nov 2009 18:34:34 Z2009-11-16T18:34:34Z