Latest News

  • Super Tower Defense 2 Game
    Sep 03, 2010

    New to the games section is Super Tower Defense 2. Featuring more maps, new units and bigger explosions.

  • Super Cards Online Multiplayer Game
    Aug 13, 2010

    Released today in the games section is the new Super Cards multiplayer card game. The aim of the game is to get rid of all your playing cards before your opposition.

  • Silverlight Online Chat
    Jul 24, 2010

    Today we launch the new Silverlight Live Chat application demonstrating the Liquid RichTextBox and Emoticon replacements.

  • New Super Shoot Em Up 2 Game
    Jun 29, 2010

    Added to the Games section is the new Super Shoot 'Em Up 2 game. Take control of your tank with the aim to defeat the computer controlled opponents. Features all new weapons, levels and Battle Mode!

  • Silverlight 4 Controls V5.3.2 Released
    Jun 28, 2010

    This release contains several fixes raised in the forums.

CharlieHess
CharlieHess
RichText property of RichTextBlock not working Posted: Jun 17, 2010
 

I am trying to save the RichText from a RichTextBox in a database and display it later on a RichTextBlock. Every method I have tried does not seem to work at all. I have tried the Save method on RichTextBox, and then the Load method on the RichTextBlock. This does not work. I then tried to simply copy the RichText property from the RichTextBox and assign it to the RichText property of the RichTextBlock. That did not work either. How are you supposed to use this control?


I am saving out as XML, and I have a very simple test that will not work. Here is the XML I save out:


- <LiquidRichText xmlns:liquid="clr-namespace:Liquid;assembly=Liquid.RichText">

  <Style ID="Normal" FontFamily="Arial" FontSize="11" Foreground="#FF000000" Alignment="Left" VerticalAlignment="Center" />

  <TableStyle ID="TableDefault" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CellBorderBrush="#FF000000" CellBorderThickness="1,1,1,1" CellPadding="2" />

- <Text Style="Normal">

- <![CDATA[ Test ]]>

  </Text>

  </LiquidRichText>


And here is the XML that comes back from the database:


- <LiquidRichText xmlns:liquid="clr-namespace:Liquid;assembly=Liquid.RichText">

  <Style ID="Normal" FontFamily="Arial" FontSize="11" Foreground="#FF000000" Alignment="Left" VerticalAlignment="Center" />

  <TableStyle ID="TableDefault" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CellBorderBrush="#FF000000" CellBorderThickness="1,1,1,1" CellPadding="2" />

  <Text Style="Normal">Test</Text>

  </LiquidRichText>


This XML comes back as one big string. I then tried two different approaches:


1. Binding the RichTextBlock.RichText property to this string.

2. Using the Load method of the RichTextBlock to load this string in, passing in Format.XML as the format parameter.


Neither approach works.

 
 
CharlieHess
CharlieHess
RE: RichText property of RichTextBlock not working Posted: Jun 17, 2010
 

After further investigation and diving into the source code, it appears you have a bug in your BuildXMLPortionAsElementList function, RichTextBlock.cs. I'm not sure exactly what is happening, but for some reason the TableStyle element is causing the Text element to be skipped entirely. If I remove the TableStyle element from the XML I posted above, the Load works fine.

 
 
dan
dan
RE: RichText property of RichTextBlock not working Posted: Jun 18, 2010
 

Hi,


When saving the content of the RichTextBox as XML you must store it exactly as it is in order for it to be correctly re-loaded at a later date.  Looking at the XML coming out of your database the CDATA tag is missing, the TableStyle tag has become self-closing.  It is these changes that are stopping it from being reloaded.


When savign RichText content simple save it as a string and do not alter the formatting or content in any way.


Thanks!