C# 无法在按钮上设置文本

C# 无法在按钮上设置文本,c#,wpf,C#,Wpf,我正在尝试设置按钮上的文本。 这是我的密码: btn = new Button(); btn.Content = "A"; btn.Height = '*'; btn.Width = 200; btn.Margin = new Thickness(10); btn.Padding = new Thickness(100); btn.VerticalAlignment = VerticalAlignment.Center; btn.SetValue(Grid.ColumnProperty, c

我正在尝试设置按钮上的文本。 这是我的密码:

btn = new Button();
btn.Content = "A";


btn.Height = '*';
btn.Width = 200;
btn.Margin = new Thickness(10);
btn.Padding = new Thickness(100);
btn.VerticalAlignment = VerticalAlignment.Center;
btn.SetValue(Grid.ColumnProperty, column);
btn.SetValue(Grid.RowProperty, row);

一切正常,除了我不能在按钮上显示文本。
请给我指引正确的方向

由于您的宽度是200,而填充(从各个方向缩小内容的空间)是100,因此您的内容没有更多的空间。请尝试使用较小(或不使用)的填充。

您能给我们看看您的xaml代码吗?我猜高度无效。尝试进行一次测试,将高度设置为40@eranotzap还是不行@Domysee除了网格定义外,xaml中没有其他内容……您是否将按钮添加到网格中了?