Disable selecting of header/graying of content

2 posts, 0 answers
  1. SurgicalScience
    SurgicalScience avatar
    1 posts
    Member since:
    Mar 2012

    Posted 06 Oct Link to this post

    I'm using a RadRichTextBox as a pure preview for printing. IsReadOnly is
    set to True, but you can still enter header edit mode.

    This means that when the document is first shown, the header is grayed out.
    And when you double click the header, entering edit mode, the
    rest of the content is grayed out.

    This will lead to a kind of "false preview" of the document, as the colors will not match the final print.

    Is there any way to enter a "true" read only/print preview state?

  2. Tanya
    Admin
    Tanya avatar
    575 posts

    Posted 10 Oct Link to this post

    Hello Göran,

    You could achieve a similar behavior by overriding the template of the FooterPresenter/HeaderPresenter. This would allow you to set their IsEnabled property to False:
    <Style TargetType="telerikUI:FooterPresenter">
        <Setter Property="IsEnabled" Value="False"/>
    </Style>
     
    <Style TargetType="telerikUI:HeaderPresenter" >
        <Setter Property="IsEnabled" Value="False"/>
    </Style>

    The following snippet demonstrates how the HeaderFooterPresenterBaseStyle is defined:
    <Style x:Key="HeaderFooterPresenterBaseStyle" TargetType="telerikUI:HeaderFooterPresenterBase">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikUI:HeaderFooterPresenterBase">
                    <Grid>
                        <StackPanel x:Name="WrappingStackPanel">
                            <telerik:RadRichTextBox x:Name="BodyRichTextBox"
                                                AllowScaling="False" Background="Transparent"
                                                Margin="0" Padding="0" MouseOverBorderThickness="0" BorderThickness="0"/>
                        </StackPanel>
                        <Rectangle x:Name="FadingRectangle" Fill="Transparent" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    Additionally, I logged a task to provide an easier approach to achieve this behavior. You can vote for its implementation and subscribe to track its status using this public item.

    Hope this is helpful.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top