default.aspx
Silverlight .NET Controls and CMS
Home
controls.aspx
Silverlight Controls
Controls
Rich TextBlock

Silverlight Rich TextBlock

The Rich TextBlock control provides a read-only view of a Rich Text XML file generated by the Liquid Rich TextBox.

This Silverlight only Rich TextBlock Control is easy to implement on your Silverlight driven website and is also customizable to provide a visual feel suitable for any site design.

How to Use the Rich TextBlock Control

To use the Rich TextBlock on your Silverlight page:

<UserControl x:Class="RichTextBlock.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:liquid="clr-namespace:Liquid;assembly=Liquid"
    Width="500" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <ScrollViewer>
            <liquid:RichTextBlock WrapWidth="480" RichTextURL="RichText.xml" />
        </ScrollViewer>
    </Grid>
</UserControl>

 

In this example we load an XML file containing Rich Text, this is called RichText.xml and is specified in the RichTextURL property. It is important you have this file included in your project.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace RichTextBlock
{
    public partial class Page : UserControl
    {
        public Page()
        {
            InitializeComponent();
        }
    }
}

 

Example Silverlight Rich TextBlock Control:

Silverlight Rich TextBlock Control

Your Comments and Questions Answered

 You are not logged in. You need to login to post new messages, if you do not have a login you can register for free!

dan said:

Hi STEVESUCH,

Thanks for your comments and were glad you like the controls. The issue you are having seems to be a bug when setting the wrap width programatically, I've added it to the fix list for the next version. Thanks!

12/26/2008 06:47
 
dan said:

Hi mmisztal,

Not at the moment, were trying to get this implemented in the next version, thanks for hilighting this!

12/26/2008 06:38
 
STEVESUCH said:

Hi,
I've downloaded your controls as I'm trying to get users to create rich text using the editor and then display using the block. Thanks a lot for providing them, they're great controls!
I'm having problems with creating the Richtextblock dynamically though. When I create them and set the wrapwidth to 400 say, they don't update and seem to stay on 180. Any ideas?

Thanks a lot.

12/22/2008 08:19
 
mmisztal said:

Is it possible to do a Text="{Bidnding SOME_PROPERTY}" in this control ? I'm trying to databind it but no luck yet

12/17/2008 08:09
 
dan said:

Hi,

Yes, remove the RichText="", the value of this property should be valid RichText XML. To set the contents of a Rich TextBlock to empty, use Text="" or just don't set the RichText field. Thanks!

12/14/2008 10:53
 
denappel@gmail.com said:

I downloaded the richtextcontrol and try to use it.
It didn't work, I got the following exception:

AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 30 Position: 23]

the tag of the control is:
                <my:RichTextBlock RichText="" WrapWidth="480" x:Name="txtPoem"></my:RichTextBlock>

What can be the problem here?

12/06/2008 05:07
 
This page is 20.21KB and was generated by the SilverPages CMS in 0.218 seconds. Total impressions: 1142.