Mike Taulty's Blog
Bits and Bytes from Microsoft UK
Silverlight 5 Beta Rough Notes–Linked RichTextBoxes

Blogs

Mike Taulty's Blog

Elsewhere

Archives

Note: these are early notes based on some initial experiments with the Silverlight 5 beta, apply a pinch of salt to what you read.

You’ll find a new class in the Silverlight 5 beta framework called the RichTextBoxOverflow – this is a really simple but really clever idea in that you can set up a RichTextBox and then you can tell it to overflow any content that doesn’t fit into that textbox into a RichTextBoxOverflow. It really is that simple so something along the lines of;

  <Grid
    x:Name="LayoutRoot"
    Background="White">
    <Grid.ColumnDefinitions>
      <ColumnDefinition />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <RichTextBox
      OverflowContentTarget="{Binding ElementName=overflow}" />
    <RichTextBoxOverflow
      Grid.Column="1"
      x:Name="overflow" />
  </Grid>

and you can (sort of) see the effect below as I fill the first RichTextBox and the content flows into the second one;

image

I took this a little bit further and spend 20 mins or so putting together a simple sample that allows for dynamic addition of RichTextBoxOverflows with a limited amount of support for dragging them around on the screen. Here it is running in the page;

 
You might want to double-click the background to get it to full screen on you and, if you're not on Silverlight 5 then what it’s basically doing is;
 
image
 
allowing you to dynamically add RichTextBoxOverflows and then the content just “magically” overflows into those additional overflows and then you can have fun resizing them and see the content lay itself out.
 
Naturally, this is great for multi-column layouts like “newspaper” style apps.
 
Here’s the source for that sample to download – NB, it was put together extremely quickly.

Posted Wed, Apr 27 2011 1:09 PM by mtaulty
Filed under: , ,

Comments

Vitor Canova wrote re: Silverlight 5 Beta Rough Notes–Linked RichTextBoxes
on Thu, Apr 28 2011 1:48 AM

This is really a painful thing to do only by hand.

progg.ru wrote Silverlight 5 Beta Rough Notes–Linked RichTextBoxes
on Thu, Apr 28 2011 4:15 PM

Thank you for submitting this cool story - Trackback from progg.ru