This question is locked. New answers and comments are not allowed.
Daniel Billingsley
Top achievements
Rank 1
Daniel Billingsley
asked on 11 Sep 2010, 09:28 PM
What's the easiest way to set a default or starting font on the control? I don't see any such property directly.
I've considered setting up a document when the host page is being initialized, but I'm binding the control through the HtmlDataProvider, and I think that would just get wiped out anyway when I bind to an empty string property.
I've considered setting up a document when the host page is being initialized, but I'm binding the control through the HtmlDataProvider, and I think that would just get wiped out anyway when I bind to an empty string property.
7 Answers, 1 is accepted
0
Hi Daniel Billingsley,
You can set document's font in XAML or trough code, please read this thread for code samples: RadRichTextBox default font size.
You are right, those settings will be reset after importing new document, but you can use SetupDocument event of data provider and apply your 'default' style there.
Boby
the Telerik team
You can set document's font in XAML or trough code, please read this thread for code samples: RadRichTextBox default font size.
You are right, those settings will be reset after importing new document, but you can use SetupDocument event of data provider and apply your 'default' style there.
Don't hesitate to contact us if you have other questions.
Best wishes,Boby
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 15 Sep 2010, 12:23 PM
So, clearly the technique explained in that reference is completely useless to me.
I'll take a look at the SetupDocument event.
I'll take a look at the SetupDocument event.
0
Daniel Billingsley
Top achievements
Rank 1
answered on 17 Sep 2010, 02:09 AM
SetupDocument is never firing.
I have the following two lines in my UserControl's constructor:
I have the following two lines in my UserControl's constructor:
_htmlProvider.RichTextBox = richTextBox;
_htmlProvider.SetupDocument += _htmlProvider_SetupDocument;
Should that work?
0
Daniel Billingsley
Top achievements
Rank 1
answered on 17 Sep 2010, 02:12 AM
By the way, I tried the other technique too. when I add the document, section and paragraph I suddenly have huge margins and it looks like I'm typing in the middle of the RichTextBox. Without doing that there are no margins and I start typing at the top left of the input area, as I'd expect.
0
Hi Daniel Billingsley,
Please find attached sample project that demonstrates the usage of the SetupDocument event. Reading Using DataProviders help article might help you too.
To alter margins after import, you can use SectionDefaultPageMargin property of RadDocument, as illustrated in the sample project.
All the best,
Boby
the Telerik team
Please find attached sample project that demonstrates the usage of the SetupDocument event. Reading Using DataProviders help article might help you too.
To alter margins after import, you can use SectionDefaultPageMargin property of RadDocument, as illustrated in the sample project.
All the best,
Boby
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 18 Sep 2010, 04:00 PM
You didn't really answer my question. Shouldn't I be able to use the SetupDocument event in code behind? I finally got your sample working, only to find I now have to figure out how to navigate to the setting I want through the Document property in the SetupDocumentEventArgs. After 10 minutes I give up.
I really don't have the hours required to figure out how to do these very simple things. You've got a potentially nice control here, but it's utterly ridiculous that it's so much work to make it work with some very basic settings.
Look at the examples in this forum for doing the most basic things like setting a startup/default font and changing the background. Those are things any UserControl should allow with simple xaml settings. Period.
I really don't have the hours required to figure out how to do these very simple things. You've got a potentially nice control here, but it's utterly ridiculous that it's so much work to make it work with some very basic settings.
Look at the examples in this forum for doing the most basic things like setting a startup/default font and changing the background. Those are things any UserControl should allow with simple xaml settings. Period.
0
Hi Daniel Billingsley,
I modified sample project to use SetupDocument event in the code behind (find attached). You can find more details here. Shortly, you can do something like this:
For changing the background color of the RadRichTextBox, you actually have to change the color of Active editor presenter through the Background property, as described in this forum thread: Set background color at runtime.
You are right, the API for changing default font of the document is a bit non-intuitive and will consider changing it. However, keep in mind that RadRichTextBox can visualize the document after importing from HTML (and indeed from all supported formats, except plain text) with the font specified in the HTML itself.
Greetings,
Boby
the Telerik team
I modified sample project to use SetupDocument event in the code behind (find attached). You can find more details here. Shortly, you can do something like this:
private HtmlDataProvider htmlDataProvider;public MainPage(){ InitializeComponent(); this.htmlDataProvider = new HtmlDataProvider(); this.htmlDataProvider.RichTextBox = this.radRichTextBox; Binding binding = new Binding("Text"); binding.Source = this.radTextBox; binding.Mode = BindingMode.TwoWay; BindingOperations.SetBinding(this.htmlDataProvider, HtmlDataProvider.HtmlProperty, binding);}For changing the background color of the RadRichTextBox, you actually have to change the color of Active editor presenter through the Background property, as described in this forum thread: Set background color at runtime.
You are right, the API for changing default font of the document is a bit non-intuitive and will consider changing it. However, keep in mind that RadRichTextBox can visualize the document after importing from HTML (and indeed from all supported formats, except plain text) with the font specified in the HTML itself.
Greetings,
Boby
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
