O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Property Elements

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required