92
|
Chapter 7: Elements
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Brush
Hierarchy: DependencyObject Freezable Animatable
<Brush .../> is an abstract component that defines how an area is painted.
SolidColorBrush is most commonly referenced by other components through the use
of the predefined colors in the
Colors class (see Appendix G).
When a Brush is referenced as one of the colors from Colors, no explicit declaration is
required and the element may be referenced simply by its predefined color name. (See
Example 7-1.)
Color
Color is a structure and has no class hierarchy.
<Color
ScA="1.0"
ScR="0.0"
ScG="0.0"
ScB="1.0" />
<Color .../> defines a color.
Attributes
ScA (required)
Defines the alpha channel of this
Color. The alpha channel of a Color structure
determines the amount of transparency the color has. An alpha value of 1 indi-
cates the color is completely opaque, and a value of 0 indicates that it is
completely transparent.
ScB (required)
The blue component of this
Color. The value is a single precision floating-point
number. The range of this value is 0–1, inclusive.
ScG (required)
The green component of this
Color. The value is a single precision floating-point
number. The range of this value is 0–1, inclusive.
ScR (required)
The red component of this
Color. The value is a single precision floating-point
number. The range of this value is 0–1, inclusive.
Figure
DependencyObject ContentElement FrameworkContentElement TextElement Block
<Figure
CanDelayPlacement="true|false"
Height="200"
HorizontalAnchor="ContentCenter|ContentLeft|ContentRight|
PageCenter|PageLeft|PageRight|ParagraphCenter|
ParagraphLeft|ParagraphRight"
HorizontalOffset="10"
Example 7-1. Implicit declaration of a Brush using a predefined color
<Rectangle Fill="Blue" Width="100" Height="100" />
Figure | 93
Elements
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
VerticalAnchor="ContentBottom|ContentTop|ContentCenter|PageBottom|PageTop|
PageCenter|ParagraphTop"
VerticalOffset="10"
Width="200"
WrapDirection="Both|Left|None|Right" />
<Figure .../> is used to display inline content within a FlowDocument with special
placement properties. Figure 7-2 shows a
Figure that displays both an image and text
and is placed in the paragraph according to its declared anchor attributes.
Attributes
CanDelayPlacement (optional)
Specifies whether the
Figure can wait to place itself into the layout until after
other elements have been rendered in the
FlowDocument.
true
Placement can be delayed.
false
Placement cannot be delayed.
Height (optional)
A
Double value specifying the height of the element.
HorizontalAnchor (optional)
Specifies the position that content is anchored horizontally.
ContentCenter
The figure is anchored to the center of the page content area.
ContentLeft
The figure is anchored to the left of the page content area.
ContentRight
The figure is anchored to the right of the page content area.
PageCenter
The figure is anchored to the center of the page area.
Figure 7-2
. Using Figure to display an image and text within a FlowDocument
94
|
Chapter 7: Elements
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
PageLeft
The figure is anchored to the left of the page area.
PageRight
The figure is anchored to the right of the page area.
ParagraphCenter
The figure is anchored to the center of the current paragraph.
ParagraphLeft
The figure is anchored to the left of the current paragraph.
ParagraphRight
The figure is anchored to the right of the current paragraph.
HorizontalOffset (optional)
A
Double value representing the distance this Figure is offset from its horizontal
baseline.
VerticalAnchor (optional)
Specifies the position that content is anchored vertically.
ContentBottom
The figure is anchored to the bottom of the page content area.
ContentCenter
The figure is anchored to the center of the page content area.
ContentTop
The figure is anchored to the top of the page content area.
PageBottom
The figure is anchored to the bottom of the page area.
PageCenter
The figure is anchored to the center of the page area.
PageTop
The figure is anchored to the top of the page area.
ParagraphTop
The figure is anchored to the top of the current paragraph.
VerticalOffset (optional)
A
Double value representing the distance this Figure is offset from its vertical
baseline.
Width (optional)
A
Double value specifying the width of the element.
WrapDirection (optional)
Specifies the allowable directions in which content can wrap about the
Figure.
Both
Content may flow around both sides of the element.
None
Content may not flow around this element.
Left
Content only flows around the left side of the element.
Right
Content only flows around the right side of the element.

Get XAML in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.