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

Background is always white?

15 Answers 162 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Nicolas
Top achievements
Rank 1
Nicolas asked on 28 Jul 2010, 05:23 PM
Hi,

I am trying to use the RichTextBox to display rich text, in a read-only way (as described here: http://www.telerik.com/help/silverlight/radrichtextbox-how-to-use-rarichtextbox-as-rich-content-viewer.html). My problem is that I can't get anything but a white background. I would like the background to be transparent (or non-existent). I tried using the new TransparentTheme, and/or setting the background to Nothing but it does not work. Actually setting the background to any color (Background="Red") leaves me with a white background.

Is this a known issue or am I missing something here?

Thank you

15 Answers, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 29 Jul 2010, 04:58 PM
Hi Nicolas,
To make the rich text box background transparent first you will have to set the Background property of the control to transparent. Then you will have to set the Background property in the default style of the presenter you will be using. In case of Flow layout mode this is the DocumentWebLayoutPresenter and in case of Paged layout mode this is the DocumentPrintLayoutPresenter. If you will be using both layout modes you can set both styles.

Here is how this can be done in XAML:
<telerik:RadRichTextBox Background="Transparent">
    <telerik:RadRichTextBox.Resources>
        <Style TargetType="telerik:DocumentWebLayoutPresenter">
            <Setter Property="Background" Value="Transparent" />
        </Style>
        <Style TargetType="telerik:DocumentPrintLayoutPresenter">
            <Setter Property="Background" Value="Transparent" />
        </Style>
    </telerik:RadRichTextBox.Resources>
</telerik:RadRichTextBox>


Sincerely yours,
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
Nicolas
Top achievements
Rank 1
answered on 16 Aug 2010, 07:51 AM
Hi Boby,

thank you for your response.

I'm creating the control in the code-behind and I'm having trouble implementing this. Could you please give me the equivalent in code-behind (VB preferred) please?

Thanks
0
Accepted
Ivailo Karamanolev
Telerik team
answered on 16 Aug 2010, 11:44 AM
Hi Nicolas,

Here's how to do the equivalent to the previously mentioned XAML in code-behind:
VB:
richTextBox.Background = New SolidColorBrush(Colors.Transparent)
richTextBox.Resources = New ResourceDictionary()
 
Dim webLayoutStyle As New Style(GetType(DocumentWebLayoutPresenter))
webLayoutStyle.Setters.Add(New Setter(DocumentWebLayoutPresenter.BackgroundProperty, Colors.Transparent))
richTextBox.Resources.Add(GetType(DocumentWebLayoutPresenter), webLayoutStyle)
 
Dim printLayoutStyle As New Style(GetType(DocumentPrintLayoutPresenter))
printLayoutStyle.Setters.Add(New Setter(DocumentPrintLayoutPresenter.BackgroundProperty, Colors.Transparent))
richTextBox.Resources.Add(GetType(DocumentPrintLayoutPresenter), printLayoutStyle)
C#:
richTextBox.Background = new SolidColorBrush(Colors.Transparent);
richTextBox.Resources = new ResourceDictionary();
 
Style webLayoutStyle = new Style(typeof(DocumentWebLayoutPresenter));
webLayoutStyle.Setters.Add(new Setter(DocumentWebLayoutPresenter.BackgroundProperty, Colors.Transparent));
richTextBox.Resources.Add(typeof(DocumentWebLayoutPresenter), webLayoutStyle);
 
Style printLayoutStyle = new Style(typeof(DocumentPrintLayoutPresenter));
printLayoutStyle.Setters.Add(new Setter(DocumentPrintLayoutPresenter.BackgroundProperty, Colors.Transparent));
richTextBox.Resources.Add(typeof(DocumentPrintLayoutPresenter), printLayoutStyle);

I hope this solves your problem. Let us know if you need further assistance.

Kind regards,
Ivailo
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
Nicolas
Top achievements
Rank 1
answered on 16 Aug 2010, 12:16 PM
Hi Ivailo,

thanks for the details. That worked out perfectly.
0
Ivailo Karamanolev
Telerik team
answered on 16 Aug 2010, 03:16 PM
Hello Nicolas,

It's good to hear this solution worked. Let us know if you have any other issues.

All the best,
Ivailo
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
prog1
Top achievements
Rank 1
answered on 17 Sep 2010, 02:01 PM
If I use the transparent background, than I can see a white cursor if the textbox is not in focus.
How to change this to transparent? If I select the text the cursor changes from white to black, which is ok.
0
prog1
Top achievements
Rank 1
answered on 21 Sep 2010, 09:03 AM
Can I change something like the CoursoAlternatingColor to "transparent" with a style, too?
0
Alex
Telerik team
answered on 22 Sep 2010, 08:18 AM
Hello prog1,

We were unable to reproduce the "white cursor" problem - when the rich text box is not focused the caret is not shown. We will appreciate if you elaborate further and send us a sample project through the support system that exhibits the issue so we can investigate it locally.

Sincerely yours,
Alex
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
prog1
Top achievements
Rank 1
answered on 27 Sep 2010, 10:06 AM
Tried to reproduce it, but did not get it.
It's just in my real application.

Will try to get it later, again.
0
Iva Toteva
Telerik team
answered on 28 Sep 2010, 08:49 AM
Hello Fabian,

 We are sorry that we are not able to offer you any solutions to your problem.
Feel free to get back to us when you reproduce it or if any other issues arise.

Kind regards,
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
0
prog1
Top achievements
Rank 1
answered on 26 Jan 2011, 09:49 AM
I can reproduce it now.
Just got to ExpressionBlend, put a RadRichTextbox on a control without background.
Set the Background of the RadRichTextbox to "null" as well.
Now you can see the white cursor.

How can I change this to "null" or transparent, too?
0
Iva Toteva
Telerik team
answered on 28 Jan 2011, 04:33 PM
Hello Fabian,

I am sorry but I am still unable to reproduce the issue.
Since you have managed to isolate the problem in a simple project, would it be possible that you send it over in a support ticket? In this way we would be able to track down the problem and address it more easily.
Looking forward to your reply.

All the best,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
prog1
Top achievements
Rank 1
answered on 31 Jan 2011, 11:17 AM
After a lot of searching, I finally got the failure.
There was a wrong style definition, I did not see. So it was not a problem with the telerik control.

Thanks a lot and sorry it was my fault.
0
Toby Riley
Top achievements
Rank 1
answered on 08 Apr 2011, 01:39 PM
Hi,

I'm tying to set my cursor as white but cannot seem to do this. How did it happen for you?

Thanks T.
0
Mike
Telerik team
answered on 11 Apr 2011, 09:37 AM
Hi Tobias Riley,

Please find our answer in the following forum thread:
http://www.telerik.com/community/forums/silverlight/richtextbox/how-to-change-the-cursor-s-color.aspx

All the best,
Mike
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
Nicolas
Top achievements
Rank 1
Answers by
Boby
Telerik team
Nicolas
Top achievements
Rank 1
Ivailo Karamanolev
Telerik team
prog1
Top achievements
Rank 1
Alex
Telerik team
Iva Toteva
Telerik team
Toby Riley
Top achievements
Rank 1
Mike
Telerik team
Share this question
or