Vectorlight News

  • Chat App Converted to HTML and JQuery
    Sep 08, 2011

    Converted from Silverlight to HTML and Javascript/JQuery is the Vectorlight Chat App. Login using your Vectorlight password to chat using your username and avatar.

  • HTML5 iPhone,Android Big Guns Tower Defense
    Jul 02, 2011

    Big Guns has made the leap from Windows Phone 7 (XNA) to HTML5 so you can now play it on your iPhone, Android and other HTML5 compatible devices.

  • HTML5 Games - Word Poppers and Batty
    Jun 04, 2011

    As the take-up of HTML5 quickens (74% of users currently have a browser capable of HTML5 Canvas) we present two more games for both your browser and mobile.

  • Big Guns Tower Defense on Windows Phone 7
    May 06, 2011

    Coming soon to Windows Phone 7 is an XNA port of the popular Vectorlight tower defense game Super Tower Defense. Whilst retaining many of the graphical and gameplay features of the original Silverlight game.

  • Wakacube WP7 Update
    Apr 26, 2011

    Released to the Windows Phone 7 marketplace today is Version 1.1 of Wakacube the 3D physics game of skill. Included in the update are more levels (30 in total) and new mode Wakatime which generates random crate structures to keep players entertained long after the levels have been completed.

  • Home Page News
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!