Button TempButton = new Button();
TempButton.Tag = “按钮标记”;
TempButton.Height = 30; TempButton.Width = 100;
TempButton.Style = this.FindResource("ButtonStyle_blue") as Style; //颜色 TempButton.Background = new SolidColorBrush(Colors.Black);//背景色 TempButton.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x6e, 0x6e, 0x6e));//前景色(字体颜色) //字体
TempButton.FontFamily = new FontFamily("Microsoft YaHei");
TempButton.FontSize = 13; TempButton.FontWeight = FontWeights.Normal;
//布局 TempButton.Margin = new Thickness(0);
TempButton.VerticalAlignment = VerticalAlignment.Center; TempButton.HorizontalAlignment = HorizontalAlignment.Right;
//URL (TempButton.Background as ImageBrush).ImageSource = new BitmapImage(new Uri(“图片路径”), UriKind.Absolute));
Wrappanel.Children.Add(TempButton);