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

Disable selecting of header/graying of content

1 Answer 63 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
SurgicalScience
Top achievements
Rank 1
SurgicalScience asked on 06 Oct 2017, 06:33 AM

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?

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 10 Oct 2017, 01:47 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
SurgicalScience
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or