def get_text(self, text): tb = TextBlock() tb.Text = text tb.Width = self.canvas.ActualWidth tb.Height = 40 tb.FontSize = 30 tb.Background = SolidColorBrush(Colors.Black) tb.Foreground = SolidColorBrush(Colors.White) tb.TextAlignment = TextAlignment.Center return tb