Mega Code Archive

 
Categories / C# / WPF
 

Fill Polygon with RadialGradientBrush

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     x:Class="Microsoft.Samples.Graphics.RectangleExample"     WindowTitle="Example">   <Canvas>         <Polygon Name="hexagon"           Stroke="Blue"           StrokeThickness="2.0"           Points="16,130 302,13 304,249 76,322 493,249 495,103">           <Polygon.Fill>             <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">               <RadialGradientBrush.GradientStops>                 <GradientStop Color="Yellow" Offset="0" />                 <GradientStop Color="Gold" Offset="0.25" />               </RadialGradientBrush.GradientStops>             </RadialGradientBrush>           </Polygon.Fill>         </Polygon>       </Canvas> </Page>