none
Understanding WPF controls rendering and multiple rendering RRS feed

  • Question

  • Hi!

    I have a project which generates .xps document. I do that with help of wpf controls. After I build whole hierarchy that I need, I force it to render itself with the help of Arrange method. I read a lot and I found out that there is a separate rendering thread which deal with the rendering. My first question is : Is there a possibility to come across of the not completely rendered objects and save them in my .xps? (I haven't got such kind of problems until now but I want to eliminate this possibility)

    Because of the new asked functionality afterwards I render my objects with Arrange calling I need to change Text property of some of the TextBlocks inside. Afterwards I call Arrange again but it doesn't take any effect. Content in the .xps is like I rendered objects only first time. I tried to put current thread to sleep but there was no result. In my oppinion WPF does not render again objects that were already rendered. Is it true? I tried to call InvalidateMesure and InvalidateArrange but it also didn't work. The case that works for me was that I create new textblock and new border around it which are copies of the existing ones and put it in the visual tree. Am I in this way some kind of force layout to be rendered again?

    Please give me some explanation about rendering and multiple rendering of wpf controls.

    Wednesday, November 2, 2011 11:21 AM

Answers

All replies

  • Hi RalicaP,

    Why you want to change the TextBlocks in Arrange method, it is not a good idea, could you share your basic needs with me.

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, November 7, 2011 7:21 AM
    Moderator
  • Hi and thank you for answering!

    I don't want to change TextBlock in the Arrange method. I want to change some property of the textblock, for axample Text. Afterwards I must force TextBlock to be render again. I other way the old content of the text property will stay (because the textblock has been rendered already once).

    Best regards

    Monday, November 7, 2011 9:33 AM
  • Hi RalicaP,

    I am not sure your specific situation, if you want to change the property of TextBlock, why not use WPF binding, and then you could change data source, then Text property will be updated automatically.

    http://msdn.microsoft.com/en-us/library/ms752347.aspx

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 8, 2011 5:13 AM
    Moderator
  • Hi RalicaP,

    I am marking your issue as "Answered", if your concern persists, please let me know.

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, November 14, 2011 1:36 PM
    Moderator