This project has moved. For the latest updates, please go here.

Richtextbox : System.Windows.Markup.XamlParseException occurred

Mar 17, 2011 at 6:25 PM

Hi,

I have a datagrid to which I wish to add a new datarow below the cursor. Everything works if I use some other control like a TextBox, but when I replace this with the RTB it crashes.

When using the RTB, I get this System.Windows.Markup.XAMLParseException.

Observations:

o1) If I dont set the property that the RTB is bound to then the application starts ( the app will fail with this exception when you run it, change the called in in the window loaded event)

o2) Assuming that you start without any data in this property,type in something in all the rows, and try to add the row by pressing button or F2. It crashes with the same exception.

o3) Assuming that you start without any data in this property,type in something in some (NOT ALL) of the rows, and try to add the row by pressing button or F2. It works

Here is the link for the sample project: http://cid-d40c19d81787f0af.office.live.com/self.aspx/Public/DataGridTest.rar

Any help will be greatly appreciate it...it is driving me mad!!!

Thanks

Mar 17, 2011 at 6:41 PM
Edited Mar 17, 2011 at 6:42 PM

In order to use the XamlFormatter, your text must be in a XAML format.

"Some text 1" is not in a XAML format, you must either convert this text into a XAML format before trying to load the RTB, or use the RTFFormatter or PlainTextFormatter.

Mar 18, 2011 at 9:03 AM

Thanks a lot Brian!. I was using the HtmlToXamlConverter when getting the data from the web service, but forgot to use it when creating/appending a new row!!! (HtmlToXamlConverter.ConvertHtmlToXaml("", false))

Note: I totally forgot about the converter in the sample project!

THANKSSSSS!