When adding custom code to a Text Layout window:

I switched back to Layout View and everything looked the way it was should:

But when I stop editing the window, nothing shows up:

Is this common? Are there work-arounds? Am I missing any key parts of code?
Any help would be fantastic, thank you!