Refresh UX element from UNO

I’m using the all mighty Text element to create nice looking piece of text and capture it as framebuffer in UNO. Later I store this to my texture atlas.

Now, how can I force the element to refresh its look after I have changed the Text.Value? Text changes but alignment and margins are off.

    TextView.Value = nextStr;

    // THIS DOESN'T HELP
    TextContainer.InvalidateLayout();
    TextContainer.InvalidateVisual();

    TextView.InvalidateLayout();
    TextView.InvalidateVisual();
    //

    var Capture = TextContainer.CaptureRegion(_dc, new Uno.Rect(0,0,256,256), float2(0,0));

I got this working by waiting for a one frame after setting the text, but that’s rather slow when I need to do it for each piece of text.

Hi,

Layout is not performed immediately, it is performed the next frame during the Update sweep. This is why things will probably be out of date here.

You either need to wait a frame, or you can try calling the PerformLayout method. However, this method is protected so it can only be called from a subclass.

Awesome, PerformLayout works just great!