29 Core XAML
What’s In This Chapter?
- XAML syntax
- Dependency properties
- Routed events
- Attached properties
- Markup extensions
Wrox.com Code Downloads for This Chapter
The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples, for both WPF and Universal Windows apps:
- Code Intro
- XAML Intro
- Dependency Objects
- Routed Events
- Attached Properties
- Markup Extensions
Uses of XAML
When you’re writing a .NET application, usually C# is not the only syntax you need to know. If you write Universal Windows apps, Windows desktop applications using Windows Presentation Foundation (WPF), or workflows with Windows Workflow Foundation (WF); create XPS documents, or write Silverlight apps, you also need XAML. XAML (eXtensible Application Markup Language) is a declarative XML syntax that’s usually needed with these applications. This chapter describes the syntax of XAML and the extensibility mechanisms that are available with this markup language. The chapter describes the differences between XAML in WPF applications and Windows apps using the Universal Windows Platform (UWP).
All that can be done with XAML can also be done with C#—so why is there a need for XAML? XAML is typically used to describe objects and their properties, and this is possible in a deep hierarchy. For example, a Window control contains a Grid control; the Grid control contains a StackPanel
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access