Lorem Ipsum Attached Property

I do not know about everyone out there but sometimes I cannot wait to have the back-end available before I start with the UI and UX. For data grids and the like Expression Blend supports automatic generation of dummy data. However, this type of automatic support seems to stop there and filling random text into text boxes, text blocks, and rich text blocks can be tedious and not very thrilling. Well, after doing this in a number of projects over time I got to thinking how I could simplify this process when building a prototype and remembered that some projects had resorted to Lorem Ipsum text fills to flesh-out the design. Therefore, I started to think how I could automate text generation using Lorem Ipsum in some way. Well this is how it all turned out…

Lorem Ipsum

Lorem Ipsum has been around for a very long time predating the modern DTP systems and many electronic typesetting applications. Lorem Ipsum dates back to the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. Contrary to popular belief, Lorem Ipsum is not simply random text and has roots in a piece of classical Latin literature dating back over 2000 years. The reason why it is being used today is a long established fact that a designer will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters making it look like readable text.

Design

The challenge here is to produce readable text using a dictionary of Latin words. Additionally, there is also a need to define the number of paragraphs, sentences per paragraph, the number of words and/or the average number of words in a sentence. Another feature would be to have the possibility to have the text as bullet points or some kind of list. It would be easy to produce fixed sentences with a given number of words but written text is almost never so structured.

With this information the properties required for the Attached Property can now be defined:

  1. Number of paragraphs in the generated text.
  2. The total number of words in the generated text
  3. The number of words in a sentence. An automatic deviation is also possible here as well.
  4. The approximate/average number of sentences in a paragraph. An automatic deviation is also possible although not explored here.

The code can be found here, and the XAML here. Below is an example of the Lorum Ipsum attached property in use.

Advertisements

~ by Intelligence4 on May 11, 2011.

 
%d bloggers like this: