This question is locked. New answers and comments are not allowed.
Hello,
I have a bug with the RichTextBox (silverlight 4.0). I did a RichTextBox in which you can choose two fonts. In order to have the right font and the right font-size when the RichTextBox is loaded, I load something on the event SetupDocument of provider:
Xaml :
Obviously, in the else here, I can’t have multiple fonts in a reloading html content generated by the same RichTextBox but I am waiting for the resolution of my problem. Indeed, I have to do that because otherwise I always have default options of the RichTextBox. But suddenly my problem is when the RichTextBox load, I can’t load content that uses both of my fonts.
For information I am using the Q1 2011 SP1.
Thanks by advance for your help.
Adrien
I have a bug with the RichTextBox (silverlight 4.0). I did a RichTextBox in which you can choose two fonts. In order to have the right font and the right font-size when the RichTextBox is loaded, I load something on the event SetupDocument of provider:
Xaml :
<telerikDocumentsHtml:HtmlDataProvider x:Name="Provider" SetupDocument="Provider_SetupDocument" RichTextBox="{Binding ElementName=radRichTextBox}" Html="{Binding Content, Mode=TwoWay, NotifyOnValidationError=True}">
<telerikDocumentsHtml:HtmlDataProvider.FormatProvider>
<telerikDocumentsHtml:HtmlFormatProvider>
<telerikDocumentsHtml:HtmlFormatProvider.ExportSettings>
<telerikDocumentsHtmlModel:HtmlExportSettings
DocumentExportLevel="Fragment"
StylesExportMode="Inline" />
</telerikDocumentsHtml:HtmlFormatProvider.ExportSettings>
</telerikDocumentsHtml:HtmlFormatProvider>
</telerikDocumentsHtml:HtmlDataProvider.FormatProvider>
</telerikDocumentsHtml:HtmlDataProvider>
C# (Code-Behind) :
private void Provider_SetupDocument(object sender, Telerik.Windows.Documents.FormatProviders.SetupDocumentEventArgs e) { e.Document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(0, 0, 0, 0); FontFamily franklinGothicLTBook = new FontFamily("ITCFranklinGothicLTBook"); //// Set the default font size for an empty document if (String.IsNullOrEmpty(this.Provider.Html)) { e.Document.Measure(RadDocument.MAX_DOCUMENT_SIZE); e.Document.Arrange(new RectangleF(PointF.Empty, e.Document.DesiredSize)); //// 13.57 ==> 10 Word ((Span)e.Document.CaretPosition.GetCurrentInlineBox().AssociatedDocumentElement).FontSize = 13.67; ((Span)e.Document.CaretPosition.GetCurrentInlineBox().AssociatedDocumentElement).FontFamily = franklinGothicLTBook; } else { ////Set the font size of an existing document e.Document.Selection.SelectAll(); e.Document.UpdateSelectedSpansStyle((span) => { span.FontSize = 13.67; span.FontFamily = franklinGothicLTBook; return span; }); } }Obviously, in the else here, I can’t have multiple fonts in a reloading html content generated by the same RichTextBox but I am waiting for the resolution of my problem. Indeed, I have to do that because otherwise I always have default options of the RichTextBox. But suddenly my problem is when the RichTextBox load, I can’t load content that uses both of my fonts.
For information I am using the Q1 2011 SP1.
Thanks by advance for your help.
Adrien
