When the LayoutMode is Paged the Background

4 posts, 2 answers
  1. Yunfan
    Yunfan avatar
    8 posts
    Member since:
    Jun 2011

    Posted 11 Jan 2012 Link to this post

    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(⊙_⊙)?
  2. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 13 Jan 2012 Link to this post

    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 >>

  3. Yunfan
    Yunfan avatar
    8 posts
    Member since:
    Jun 2011

    Posted 14 Jan 2012 Link to this post

    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 (⊙_⊙)?
  4. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 18 Jan 2012 Link to this post

    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 >>

Back to Top