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

Problem with Richtextbox inside childwindow

5 Answers 69 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
aubrey
Top achievements
Rank 1
aubrey asked on 01 Jul 2011, 08:33 AM
Good day Telerik Team,

I am currently using your new "RadControls for Silverlight Q2 2011 Demos", and it works fine.

When i tried to put radrichtextbox inside a new ChildWindow and I set the "IsReadOnly" property to true:
<telerik:RadRichTextBox Grid.RowSpan="2" HorizontalAlignment="Stretch" IsContextMenuEnabled="False" IsReadOnly="True" IsSelectionEnabled="False" IsSelectionMiniToolBarEnabled="False" IsSpellCheckingEnabled="False" LayoutMode="Paged" Margin="0,0,13,29" x:Name="rtbPrev" VerticalAlignment="Stretch" AllowScaling="True" Style="{StaticResource RadRichTextBoxStyle1}" IsImageMiniToolBarEnabled="False" IsInHeaderFooterEditMode="False" IsFocusable="False"/>
and I create an instance of this childwindow:
private void Doc_Preview(object sender, System.Windows.RoutedEventArgs e)
{
            Preview prev = new Preview();


            RadDocument doc = new RadDocument();


            this.radRichTextBox1.Document.Selection.SelectAll();


            doc = this.radRichTextBox1.Document.Selection.CreateDocumentFromSelection();
            radRichTextBox1.Document.Selection.Clear();
            doc.CaretPosition.MoveToFirstPositionInDocument();

            prev.rtbPrev.Document = doc;
            prev.rtbPrev.Document.Sections.First.Headers = radRichTextBox1.Document.Sections.First.Headers;
            prev.rtbPrev.Document.Sections.First.Footers = radRichTextBox1.Document.Sections.First.Footers;
            prev.rtbPrev.Document.SectionDefaultPageOrientation = radRichTextBox1.Document.Sections.First.PageOrientation;
            prev.rtbPrev.Document.SectionDefaultPageMargin = radRichTextBox1.Document.Sections.First.ActualPageMargin;
            prev.rtbPrev.LayoutMode = radRichTextBox1.Document.LayoutMode;
            prev.rtbPrev.Document.CopyPropertiesFrom(radRichTextBox1.Document);

            prev.rtbPrev.ScaleFactor = new Size(0.55, 0.55);
            prev.Show();
}
And when I call Doc_Preview() the main screen turns to white, and i lose my control on it.

But when I turn "IsReadOnly" to false the child window will appear and my main page/screen does not freak out.

I also tried this one using your "RadControls for Silverlight Q1", and it works fine even if i turn  radrichtextboxs "IsReadOnly" to true. 

Is there a way that I can set the property of a radrichtextboxs "IsReadOnly" to true inside a childwindow and I will not lose control of my main screen (using your "RadControls for Silverlight Q2 2011 Demos")?   

hoping for your reply,
Aubrey :')

5 Answers, 1 is accepted

Sort by
0
aubrey
Top achievements
Rank 1
answered on 06 Jul 2011, 08:37 AM
Good day telerik,

Is this problem possible to be resolve? or is it a bug when a radrichtextbox is put into a childow and setting the "IsReadOnly" property to true(which causes the main page to turn to white)? :(

Hoping for your reply,
Aubrey :(
0
aubrey
Top achievements
Rank 1
answered on 11 Jul 2011, 05:17 AM
Good day telerik,

Is there anyone who can help me with this, or can maybe give me an idea how to solve this?

thanks,
Aubrey :(
0
Accepted
Iva Toteva
Telerik team
answered on 12 Jul 2011, 08:09 AM
Hi Aubrey,

Thank you for reporting this issue. I have tested this scenario with the development version and everything worked OK. Once the Q2 is out (in less than a week), the issue should be resolved.
As a workaround with the Q2 Beta version of the controls (2011.2 623), you can set the IsReadOnly to True when the RichTextBox is loaded, e.g.:

private void rtbPrev_Loaded(object sender, RoutedEventArgs e)
{
    ((RadRichTextBox)sender).IsReadOnly = true;
}

The Telerik points in your account have been updated in appreciation of your involvement. Greetings,
Iva
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
aubrey
Top achievements
Rank 1
answered on 13 Jul 2011, 06:11 AM
Hi Iva,

thank your for the reply, and thank you for the points, :)

I've loaded the richtexbox and set IsReadOnly to True, but theres an exception thrown:
"Unable to cast object of type 'ReportsUI.Preview' to type 'System.Windows.Controls.RichTextBox'."

heres the code:
private void RtbLoad(object sender, RoutedEventArgs e)
{
    ((RichTextBox)sender).IsReadOnly = true;
}

is there a way i can fix this?

thanks, 
Aubrey :)
0
aubrey
Top achievements
Rank 1
answered on 13 Jul 2011, 06:29 AM
Hi Iva,

i already know my mistake. i got it now. since i am using RadRichTextbox  i cant cast it richtextbox. heres my code:
private void RtbLoad(object sender, RoutedEventArgs e)
{
    ((RadRichTextBox)sender).IsReadOnly = true;
}


thanks for the thought Iva, :)

regards,
Aubrey :)
Tags
RichTextBox
Asked by
aubrey
Top achievements
Rank 1
Answers by
aubrey
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or