Ericky14 Posted January 17, 2018 Share Posted January 17, 2018 Hello, I am trying to create a TextBlock with textwrapping and wait until the _lines property has been calculated. Is there any sure way of doing that? Maybe some function I can call to have it calculated instead of having to use an observable. (Also, the TextBlock is child to a StackPanel) Right now I am creating the TextBlock and using TextBlock.onDirtyObservable and inside that I check TextBlock._lines. However, this value can sometimes be wrong as I have seen. This seems to be due to _context.measureText returning different values at times. I observed this behavior when I force reload the page, if I just reload it normally the _lines property is properly computed. Maybe there is some kind of caching on the canvas context or something that makes it return different text widths? Any help on this would be appreciated. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.