Table in header update issue

4 posts, 0 answers
  1. Tamas
    Tamas avatar
    4 posts
    Member since:
    May 2012

    Posted 11 Oct 2012 Link to this post

    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

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 15 Oct 2012 Link to this post

    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.

  3. DevCraft banner
  4. Tamas
    Tamas avatar
    4 posts
    Member since:
    May 2012

    Posted 15 Oct 2012 Link to this post

    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.
  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 16 Oct 2012 Link to this post

    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

Back to Top