See code below to calculate the required size (look for "theRectYouAreLookingFor")
private void CanvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
CanvasDrawingSession drawingSession = args.DrawingSession;
float xLoc = 100.0f;
float yLoc = 100.0f;
CanvasTextFormat format = new CanvasTextFormat {FontSize = 30.0f, WordWrapping = CanvasWordWrapping.NoWrap};
CanvasTextLayout textLayout = new CanvasTextLayout(drawingSession, "Hello World!", format, 0.0f, 0.0f);
Rect theRectYouAreLookingFor = new Rect(xLoc + textLayout.DrawBounds.X, yLoc + textLayout.DrawBounds.Y, textLayout.DrawBounds.Width, textLayout.DrawBounds.Height);
drawingSession.DrawRectangle(theRectYouAreLookingFor, Colors.Green, 1.0f);
drawingSession.DrawTextLayout(textLayout, xLoc, yLoc, Colors.Yellow);
}