ImageBrush | Hierarchy: DependencyObject ContentElement FrameworkContentElement Brush |
<ImageBrush Viewport="0,0,0.5,0.5" ViewportUnits="Absolute|RelativeToBoundingBox" Viewbox="0,0 10 10" ViewboxUnits="Absolute|RelativeToBoundingBox" TileMode="FlipX|FlipXY|FlipY|None|Tile" AlignmentX="Center|Left|Right" AlignmentY="Center|Top|Bottom" ImageSource="sampleImages\cherries_larger.jpg" Stretch="Fill|None|Uniform|UniformFill" /> <ImageBrush .../> allows you to paint an area using an image. Using the attributes, you can modify how the image is used to paint the area. For example, the TileMode attribute allows you to modify the view of the image itself, flipping it horizontally or vertically if desired. Figure 7-4 shows the result of evaluating Example 7-2, which uses an ImageBrush to paint the rectangle indicated by the outlined area. Figure 7-4. Using ImageBrush to paint a Rectangle Attributes
AlignmentX (optional) Describes how the image is aligned horizontally.
AlignmentY (optional) Describes how the image is aligned vertically.
ImageSource (required) Defines the source of the image used to paint the area.
Stretch (optional) Specifies how the brush's selected content is displayed in the brush's tiles.
Fill Resizes the content to fit the destination. The aspect ratio is not preserved.
None The original size is preserved; the image is not stretched.
Uniform Resizes the original content to fit the destination and preserves the native aspect ratio.
UniformToFill Resizes the original content to fit the destination and preserves the native aspect ratio. If the aspect ratio of the destination is different than the original image, the image will be clipped to fit into the destination.
TileMode (optional) Specifies how the tile fills out the object.
FlipX The same as Tile, but alternate columns of tiles are flipped horizontally. The base tile is drawn untransformed.
FlipXY The combination of FlipX and FlipY. The base tile is drawn untransformed.
FlipY The same as Tile, but alternate rows of tiles are flipped vertically. The base tile is drawn untransformed.
None Do not tile. Only the base tile is drawn; the remaining area is left transparent.
Tile The basic tile mode. The base tile is drawn, and the remaining area is filled by repeating the base tile such that the right edge of one tile abuts the left edge of the next, and likewise for bottom and top.
Viewbox (optional) Sets the position and dimensions of the Brush content in terms of the top-left corner, width, and height. The default is (0,0) with a width and height of 1, and it is defined as a Rect.
ViewboxUnits (optional) Sets the units for the Viewbox.
Absolute The coordinate system is not relative to the Brush output area. Values are interpreted directly in local space.
Viewport (optional) Sets the position and dimensions of the brush's tiles in terms of the top-left corner, width, and height. The default is (0,0) with a width and height of 1, and it is defined as a Rect.
ViewportUnits (optional) Sets the units for the ViewPort.
Absolute The coordinate system is not relative to the Brush output area. Values are interpreted directly in local space.
RelativeToBoundingBox The coordinate system is relative to the Brush output area, with 0 indicating 0 percent of the output area and 1 indicating 100 percent of the output area.
RelativeToBoundingBox The coordinate system is relative to the Brush output area, with 0 indicating 0 percent of the output area and 1 indicating 100 percent of the output area. |