Chapter 19: Windows Presentation Foundation

Quiz Solutions

Solution to Question 19-1. XAML is a subset of XML intended for use with WPF. It has a schema created by Microsoft with elements for Windows applications.

Solution to Question 19-2. You can edit the properties of a XAML element in the Properties window, or directly in the XAML window. Either way, any changes you make will immediately be reflected in the Design window.

Solution to Question 19-3. The x: refers to the current namespace for the application. You need to use it to define properties that will be used elsewhere in the application.

Solution to Question 19-4. The Margin property takes four comma-separated values, representing the distance, in units, from the left, top, right, and bottom of the window. A zero for any of the values indicates that the distance is not fixed.

Solution to Question 19-5. When you have a number of controls of the same type, you could style each control individually, but it would be easier to define a Style element as a resource.

Solution to Question 19-6. The TargetType property, applied to a Style, restricts the style to a certain type of control.

Solution to Question 19-7. The Trigger element is used for handling events within the XAML file.

Solution to Question 19-8. Animations are contained in Storyboard controls.

Solution to Question 19-9. A Trigger element can contain a storyboard action, but not a Storyboard element directly. The BeginStoryboard element provides that action, and can contain ...

Get Learning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.