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

Table in header update issue

3 Answers 86 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tamas
Top achievements
Rank 2
Tamas asked on 11 Oct 2012, 09:28 AM

Hello,

The issue is the following:

A table is inserted into the header of the RadDocument. I change the thickness of the border of the table from code, but the table on the UI doesn’t refresh. If I manually resize the table on the UI than it updates and after that the continuous update of the UI is working so if I change the border thickness property from code the table changes on the UI.
This code changes the border thickness:

 

SelectedTable.Borders = new TableBorders(new Telerik.Windows.Documents.Model.Border(value, SelectedTable.Borders.All.Style, SelectedTable.Borders.All.Color));
AssociatedObject.UpdateEditorLayout();

I tried to call SelectedTable.InvalidateAssociatedBoxesLayout(); but it didn’t help.
The question is:
How can I force update the UI after changing the table border thickness property from code?

Best regards,
Tamas

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 15 Oct 2012, 07:32 AM
Hello Tamas,

The behavior you are observing is related to the way headers and footers work. As you may know, they are separate RadRichTextBoxes and their Documents are copied several times during execution, for example when a new page is created. The code snippet you've pasted changes the borders of the current document, but then the editor does not know which of the documents should be used throughout the document and copies one of the other documents.

What you can do is use the ChangeTableBorders method of RadRichTextBox as follows:
(this.radRichTextBox.ActiveDocumentEditor as RadRichTextBox).ChangeTableBorders(new TableBorders(new Telerik.Windows.Documents.Model.Border(value, SelectedTable.Borders.All.Style, SelectedTable.Borders.All.Color)));

Please, try that and get back to us if the issue persists.
 
Greetings,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Tamas
Top achievements
Rank 2
answered on 15 Oct 2012, 12:58 PM

The use case is the following:

1. RadRichTextBox is in header footer editing mode.
2. I click inside the header and insert a table.
3. I click inside a cell of the table and try to change the thickness of the border, but the UI remains unchanged.(First time)
4. I click inside the table again, and I change the thickness of the table. The thickness of the table changed. (Second time)
5. I click inside the table again, and I change the thickness of the table. The thickness of the table changed. (Third time)

I tried to use this code to change the border size: 

(this.radRichTextBox.ActiveDocumentEditor as RadRichTextBox).ChangeTableBorders
(
new TableBorders(new Telerik.Windows.Documents.Model.Border
(value, SelectedTable.Borders.All.Style, SelectedTable.Borders.All.Color)));

For the first time the reference of the active document editor (this.radRichTextBox.ActiveDocumentEditor) is not the same as the later active document editor (,and not the same as the this.radRichTextBox). If I change the border size on this first instance of the active document editor the UI remains unchanged. For the second and third time the thickness of the table on the UI changed.
0
Petya
Telerik team
answered on 16 Oct 2012, 10:49 AM
Hi Tamas,

We are unable to reproduce the behavior you are observing.

Please find attached a sample solution I created. If the approach shown there is not the one you want to use, can you please modify it and send it back, so we can investigate further?

Thank you in advance!
 
Greetings,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate

Tags
RichTextBox
Asked by
Tamas
Top achievements
Rank 2
Answers by
Petya
Telerik team
Tamas
Top achievements
Rank 2
Share this question
or