Home Contact

Timmy Kokke

…just sorting my bubbles…

News



Timmy Kokke's Blog

↑ Grab this Headline Animator

Timmy Kokke at Blogged

Twitter












Tag Cloud


Archives

Post Categories

Image Galleries

Silverlight

Syndication:

SilverBullet #10 System.Windows.Documents.Run

silverbullet I’d like to provide you with a SilverBullet™, a small snippet of Silverlight, a class or namespace hidden in the silverlight .NET framework, to help you out in times of need. It’s not to learn, but something to keep in your pocket. Just remember it’s there and you’re safe.

When showing text to a user it's often necessary to show a few words in Italic or Bold. To do this, use the System.Windows.Documents.Run class. This class provides a small bit of HTML - like features inside a Silverlight TextBlock. But, instead of using HTML tags you have to use the Run class.

 

The Run class inherits from the abstract System.Windows.Documents.Inline which provides most of the properties to use.  A few of the most common are:

There are couple more properties which you can find here.

Another thing that might become useful when using the Run class to simulate a bit of HTML like behavior is the System.Windows.Documents.LineBreak class. This class does not have any properties or methods and can be compared to the <br /> tag in HTML.

 

Here’s a small example to show how the Run class  is used in xaml:

<Grid x:Name="LayoutRoot" Background="White"> 
    <TextBlock TextWrapping="Wrap" FontFamily="Verdana"> 
            This is an example with 
            <Run FontWeight="Black">Bold</Run>, 
            <Run FontStyle="Italic">Italic</Run> and 
            <Run Foreground="red">Colored</Run>                        
            text...<LineBreak /> 
            It's even possible to use<LineBreak />
            multiple <LineBreak />lines of text.
    </TextBlock> 
</Grid>

 

 

Shout it
Tags van Technorati:
dotNed blogger
kick it on DotNetKicks.com

Feedback

# re: SilverBullet #10 System.Windows.Documents.Run

I also facing same problem as Gerry facing. I am getting action Invoke a C# Helper functioon, once I clicks this notthing appear in the designer. am doiing everything on directly server as per your installation instruction, but no luck.ANy idea, whats wrong I am doing here?
1/15/2010 10:40 AM | strategie des jeux

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: