実行時に作成されたwpfボタン内でテキストを垂直方向に(つまり中央に)配置する方法はありますか、私は試しました:
コードスニペット
Button btn = new Button();
Style style = this.FindResource("ButtonStyle1") as Style;
btn.Style = style;
TextBlock txtTblNme = new TextBlock();
txtTblNme.Text = Convert.ToString(Tbl.SelTblNme(i));
txtTblNme.TextAlignment = TextAlignment.Center;
txtTblNme.VerticalAlignment = VerticalAlignment.Center;
txtTblNme.HorizontalAlignment = HorizontalAlignment.Stretch;
btn.Content = txtTblNme;