Gradient LinearG radientBrush RadialGradientBrush.. Linear Gradients LinearGradientBrush.
Trang 1Silverlight cung c
Silverlight
Shapes and Drawing
Grid
Fill
Data
Canvas.Left Canvas.Top
Ellipse
<Canvas>
Fill="Yellow"
Height="100"
Width="200"
StrokeThickness="2"
Stroke="Black"/>
</Canvas>
Line
<Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="4" />
<Line X1="0" Y1="0" X2="100" Y2="100" StrokeThickness="10" Canvas.Left="100">
RadiusX="0.5" RadiusY="0.5">
</Line>
<!— (10,80) (150,80) >
<Line X1="0" Y1="80" X2="200" Y2="80" Stroke="Black" StrokeThickness="4"/>
Trang 2Path
Path
<Canvas>
Data="M 100,200 C 100,25 400,350 400,175 H 280" />
</Canvas>
Polygon
<Canvas>
Points="300,200 400,125 400,275 300,200"
Stroke="Purple"
StrokeThickness="2">
</Polygon>
</Canvas>
Polyline
<Canvas>
Stroke="Blue" StrokeThickness="10"
Canvas.Left="75" Canvas.Top="50" />
</Canvas>
Rectangle
<Canvas>
Canvas.Top="20" Canvas.Left="20" StrokeThickness="3" />
</Canvas>
Geometries
Trang 3FillRule EllipseGeometry EllipseGeometry EllipseGeometry
<Canvas>
<PathFill= Gold" Stroke= Black" StrokeThickness= 1 >
<Path.Data>
<EllipseGeometry Center= 50,50" RadiusX= 50" RadiusY= 50" />
</Path.Data>
</Path>
</Canvas>
PathGeometry
<Canvas>
<PathStroke= Black" StrokeThickness= 1 >
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureStartPoint= 10,20"
<PathFigure.Segments>
<LineSegment Point= 100,130"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Canvas>
GeometryGroup
<Canvas>
<PathStroke= Black" StrokeThickness= 1 Fill= #CCCCFF"
<Path.Data>
<! Creates a composite shape from three geometries >
<GeometryGroupFillRule= EvenOdd"
<LineGeometryStartPoint= 10,10" EndPoint= 50,30" />
<EllipseGeometry Center= 40,70" RadiusX= 30" RadiusY= 30" /> <RectangleGeometryRect= 30,55 100 30" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
Brushes
Silverlight
Solid Color
Trang 4<Rectangle Width= 100" Height= 100" Fill= Red" />
</StackPanel>
.
<Rectangle Width= 100" Height= 100" Fill= #FFFF0000" />
</StackPanel>
<Rectangle Width= 100" Height= 100"
<Rectangle.Fill>
<SolidColorBrush Color= Red" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width= 100" Height= 100"
<Rectangle.Fill>
<SolidColorBrush Color= #FFFF0000" />
</Rectangle.Fill>
</Rectangle>
</StackPanel>
Gradient
LinearG radientBrush RadialGradientBrush.
Linear Gradients
LinearGradientBrush
<Rectangle Width= 200" Height= 100"
<Rectangle.Fill>
<LinearGradientBrushStartPoint= 0,0" EndPoint= 1,1"
<GradientStopColor= Yellow" Offset= 0.0" />
<GradientStopColor= Red" Offset= 0.25" />
<GradientStopColor= Blue" Offset= 0.75" />
<GradientStopColor= LimeGreen" Offset= 1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
Radial Gradients
Trang 5<Rectangle Width= 200" Height= 100"
<Rectangle.Fill>
<RadialGradientBrushGradientOrigin= 0.5,0.5" Center= 0.5,0.5"
RadiusX= 0.5" RadiusY= 0.5"
<GradientStopColor= Yellow" Offset= 0 />
<GradientStopColor= Red" Offset= 0.25" />
<GradientStopColor= Blue" Offset= 0.75" />
<GradientStopColor= LimeGreen" Offset= 1 />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
Images
L
anvas
<Canvas>
<Gridx:Name= LayoutRoot"
<Grid.Background>
<ImageBrush ImageSource= Forest.jpg" />
</Grid.Background>
</Grid>
</Canvas>
Video
x:Name="butterflyMediaElement"
Source="Butterfly.wmv" IsMuted="True"
Opacity="0.0" IsHitTestVisible="False" />
FontFamily="Verdana" FontSize="120"
FontWeight="Bold" TextWrapping="Wrap"
Text="Video">
<! Paint the text with video >
</TextBlock.Foreground>
</TextBlock>
</Grid>
Deep Zoom
http://msdn.microsoft.com/en-us/library/cc645050(VS.95).aspx