This is a migrated thread and some comments may be shown as answers.

Styling documents when data bound

1 Answer 53 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Emil Einarsson
Top achievements
Rank 1
Emil Einarsson asked on 03 May 2011, 12:56 PM
Hello!

I have a RichTextBox and it's source is bound via a DataProvider. However, I want to set some properties on the RadDocument to change the visual experience. But the document is created on the fly when using databinding.

So I tried to do this:

<Style TargetType="Model:RadDocument">
   <Setter Property="LayoutMode" Value="Flow"/>
   <Setter Property="SectionDefaultPageMargin" Value="0"/>
</Style>

But it didnt work. How can I restyle the document when using databinding?

Cheers,
E

1 Answer, 1 is accepted

Sort by
0
Accepted
Iva Toteva
Telerik team
answered on 05 May 2011, 12:22 PM
Hello Emil Einarsson,

You can use the SetupDocument event of RtfDataProvider (actually it comes from DataProviderBase, so all of the data providers have it) to set the properties of the document. Here is an example:

private void RtfDataProvider_SetupDocument(objectsender, Telerik.Windows.Documents.FormatProviders.SetupDocumentEventArgs e)
{
      //e.Document.LayoutMode = Telerik.Windows.Documents.Model.DocumentLayoutMode.Paged;
      e.Document.SectionDefaultPageMargin = newPadding(0);
}

However, if you set the property LayoutMode on the rich text box, you can skip setting it in the handler for SetupDocument.

All the best,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Emil Einarsson
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or