Rich composition of user interface elements is a hallmark of XAML-based frameworks. This can be demonstrated with the simple
Button control from Figure 1.1, because you can put arbitrary content inside it; you’re not limited to just text! To demonstrate this, the following code embeds a simple square to make a Stop button like what might be found in a media player:
C# (WPF and Silverlight):
System.Windows.Controls.Button b = new System.Windows.Controls.Button();b.Width = 96;b.Height = 38;System.Windows.Shapes.Rectangle r = new System.Windows.Shapes.Rectangle();r.Width = 10;r.Height = 10;r.Fill = System.Windows.Media.Brushes.Red;b.Content = r; // Make the square the content of the Button
C# (Windows ...