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

When the LayoutMode is Paged the Background

3 Answers 74 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Yunfan
Top achievements
Rank 1
Yunfan asked on 11 Jan 2012, 10:27 AM
When i set the RadRichTextBox's background property in layoutmode property is normal,the background is effective.
But when the LayoutMode is paged the background property is invalid,and look like something shut out.

I want to set the background property in layoutmode is paged can be effectove,please help me(⊙_⊙)?

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 13 Jan 2012, 03:23 PM
Hi Yunfan,

You can do this by setting the print layout presenter background to transparent and then the background color of the rich text box will work properly:

<telerik:RadRichTextBox x:Name="radRichTextBox" LayoutMode="Paged" Grid.Row="2" Background="Red">
            <telerik:RadRichTextBox.Resources>
                <Style TargetType="telerik:DocumentPrintLayoutPresenter">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="telerik:DocumentPrintLayoutPresenter">
                                <Border Background="Transparent">
                                    <Grid>
                                        <ContentPresenter />
                                        <telerik:DropPositionMarker x:Name="DropPositionMarker"/>
                                    </Grid>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </telerik:RadRichTextBox.Resources>
        </telerik:RadRichTextBox>

Hope this solves your problem. Do not hesitate to contact us if you have any further questions. Regards,
Martin
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Yunfan
Top achievements
Rank 1
answered on 14 Jan 2012, 10:15 AM
Sorry,my English is not good
I want to say is When RadRichTextBox's  LayoutMode   property is paged.The RadRichTextBox  page's background is always white.
I want the page's background as same as the RadRichTextBox's background.
Please help me (⊙_⊙)?
0
Accepted
Martin Ivanov
Telerik team
answered on 18 Jan 2012, 12:03 PM
Hello Yunfan,
You can do this by applying the following style to the RadRichTextBox:
<telerik:RadRichTextBox Name="radRichTextBox" Grid.Row="2" LayoutMode="Paged">
          <telerik:RadRichTextBox.Resources>
              <Style TargetType="telerik:Page">
                  <Setter Property="Template">
                      <Setter.Value>
                          <ControlTemplate TargetType="telerik:Page">
                              <Grid>
                                  <Border Padding="0" BorderThickness="1" BorderBrush="{StaticResource GridBorderBorderbrush}" Margin="-1"
                              Background="{StaticResource GridBorderBackground}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                              Effect="{StaticResource DropShadowEffect}">
                                  </Border>
                                  <Canvas x:Name="PageContentPresenter" Background="Green" />
                              </Grid>
                          </ControlTemplate>
                      </Setter.Value>
                  </Setter>
                  <Setter Property="HorizontalAlignment" Value="Center" />
                  <Setter Property="VerticalAlignment" Value="Top" />
              </Style>
          </telerik:RadRichTextBox.Resources>
      </telerik:RadRichTextBox>

And also add the following styles to the resources:
<UserControl.Resources>
       <SolidColorBrush x:Key="GridBorderBorderbrush" Color="Transparent"/>
       <SolidColorBrush x:Key="GridBorderBackground" Color="#FFFFFFFF"/>
       <DropShadowEffect x:Key="DropShadowEffect" BlurRadius="10" ShadowDepth="0" Opacity="0.4"/>
       <SolidColorBrush x:Key="PageContentPresenterBackground" Color="#FFFFFFFF"/>
   </UserControl.Resources>

Don't hesitate to contact us if you have other questions.

Kind regards,

Martin
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Yunfan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Yunfan
Top achievements
Rank 1
Share this question
or