Button myButton = new Button(); myButton.Background.SetValue(SolidColorBrush.ColorProperty, Colors.Red);
Button myButton = new Button(); Image myImage = new Image(); myImage.Source = new BitmapImage(new Uri("myImage.png", UriKind.Relative)); myButton.Content.SetValue(ContentControl.ContentProperty, myImage);The System.Windows.Controls namespace is the package library for these examples.