Transform Property (Brush)
Gets or sets the transformation that is applied to the brush. This transformation is applied after the brush's output has been mapped and positioned.
XAML |
<object Transform="Transform" .../>
|
Scripting |
value = object.Transform object.Transform = value |
Property Value
The transformation to apply to the brush.
This property is read/write. The default value is null.
Remarks
Use this property to rotate, scale, skew, or translate a brush's content.
Examples
The first example applies a RotateTransform to the RelativeTransform property of an ImageBrush. The CenterX and CenterY properties of a RotateTransform object are both set to 0.5, which is the relative coordinate of the center point of this content. As a result, the ImageBrush content rotates about its center.
XAML |
---|
<Canvas xmlns="https://schemas.microsoft.com/client/2007" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" Width="175" Height="90"> <Canvas.Background> <ImageBrush ImageSource="sampleImages/pinkcherries.jpg" > <ImageBrush.RelativeTransform> <RotateTransform CenterX="0.5" CenterY="0.5" Angle="45" /> </ImageBrush.RelativeTransform> </ImageBrush> </Canvas.Background> </Canvas> |
The following illustrations shows the ImageBrush with and without a RotateTransform.
No Transform
RotateTransform
The second example also applies a RotateTransform to an ImageBrush; however, this example uses the Transform property instead of the RelativeTransform property.
To rotate the brush about its center, the example sets the CenterX and CenterY properties of a RotateTransform object to absolute coordinates. Because the brush paints a rectangle that is 175 by 90 pixels, the center point of the rectangle is (87.5, 45).
XAML |
---|
<Canvas xmlns="https://schemas.microsoft.com/client/2007" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" Width="175" Height="90"> <Canvas.Background> <ImageBrush ImageSource="sampleImages/pinkcherries.jpg" > <ImageBrush.Transform> <RotateTransform CenterX="87.5" CenterY="45" Angle="45" /> </ImageBrush.Transform> </ImageBrush> </Canvas.Background> </Canvas> |
Applies To
ImageBrush, LinearGradientBrush, RadialGradientBrush, SolidColorBrush, VideoBrush
See Also
Silverlight Transforms Overview
Silverlight Brushes Overview
Transform