Unfotunately the simple answer is you can’t. If you would explain what you wanted to achieve by writing html in a stackpanel then, perhaps, the community could see if there were alternative ways to achieve what you want.
EDIT Just seen your other post.
One way would be to use
and use as your image. You can edit this using <canvas> techniques