Hi,
I have many string datas in RichTextBoxXaml format.
Like this,
<Section xml:space="preserve" HasTrailingParagraphBreakOnPaste="False" xmlns=" FontSize="12" FontFamily="Gulim" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Left"><Run Foreground="#FFFF0000" Text="asdf" /></Paragraph><Paragraph FontSize="12" FontFamily="Gulim" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Left"><Run Foreground="#FFFF0000" /></Paragraph><Paragraph FontSize="12" FontFamily="Gulim" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Left"><Run Foreground="#FF000000" Text="qwer" />
</Paragraph></Section>
What I want to do is,
to convert this data into RadRichTextBox Xaml format.
Such as,
<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" version="1.1" DefaultPageLayoutSettings="816,1056" LayoutMode="Flow" PageViewMargin="10,10"> <t:Section> <t:Paragraph> <t:Span FontFamily="Verdana" FontSize="16" ForeColor="#FFFF0000" Text="asdfasdfwqtr..!!!!! dafsfd dafdsafsdfasdfasf" UnderlineColor="#FF000000" UnderlineDecoration="None" /> </t:Paragraph> </t:Section> </t:RadDocument>
I tried below code.
private string ConvertMsXamlToTelerikXaml(string msXaml)
{
MsRichTextBoxXamlFormatProvider xamlProvider = new MsRichTextBoxXamlFormatProvider();
var document = xamlProvider.Import(msXaml);
RadRichTextBox richBox = new RadRichTextBox()
{
Document = document
};
XamlDataProvider provider = new XamlDataProvider();
provider.RichTextBox = richBox;
return provider.Xaml;
}
But it always gives me a paragraph without any value.
- <t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" version="1.1" DefaultPageLayoutSettings="816,1056" LayoutMode="Flow" PageViewMargin="10,10">
<t:Paragraph />
</t:Section>
</t:RadDocument>
How can I make telerik xaml successfully?
Thank you in advance.