Chapter 4

XAML and C#

After completing this chapter, you will be able to:

  • Understand what Extensible Application Markup Language (XAML) is.
  • List basic XAML objects and properties.
  • Use the XAML editor and IntelliSense in Microsoft Expression Blend.
  • Understand the basics of C#.
  • Explain the relationship of code-behind files to XAML files.
  • Create objects in C#.
  • Change properties of existing objects by using C# code.
  • Respond to events with event handlers.
Designers can no longer be only visual designers. Of course, they should be professionals in that area—but it’s no longer enough to add and work with elements solely by using a mouse. An understanding of how solutions and projects are organized, how generated code works, and how to use that code efficiently helps everyone who builds Microsoft Silverlight or Windows Presentation Foundation (WPF) applications.

XAML—What Is It?

You know from the previous chapters that Silverlight and WPF use a markup language known as XAML (Extensible Application Markup Language). Both technologies use XAML to construct user interfaces (UIs) in markup instead of in a programming language such as C# or Microsoft Visual Basic .NET.

Expression Blend Split View XAML

Introducing C# for Designers

You might have the impression that you can do anything in XAML. But, as mentioned at the beginning of this book, each project needs both designers and developers, and there is a floating boundary between these two roles. Developers need to know about organizing and grouping objects, filling objects with different types of brushes, the basics of animations, and other similar design details . Developers typically do their work directly in the Microsoft Visual Studio XAML editor. Conversely, designers should know about project structure, events, and the basics of programming. When developers and designers each understand a bit about the other discipline, it fosters a more productive relationship between them.

CS Code Behind File in Expression Blend

You can easily make this a point to YOUR company OR hide it all together.