Prev | Current Page 123 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

To define the gradient you want, you need to create a
LinearGradientBrush object.
Using the rules of XAML, you can create the LinearGradientBrush object using an element
with the name LinearGradientBrush:





...

The LinearGradientBrush is part of the WPF set of namespaces, so you can keep using the
default XML namespace for your tags.
However, it??™s not enough to simply create the LinearGradientBrush??”you also need to
specify the colors in that gradient. You do this by filling the LinearGradientBrush.GradientStops
property with a collection of GradientStop objects. Once again, the GradientStops
property is too complex to be set with an attribute value alone. Instead, you need to rely on
the property-element syntax:







...

Finally, you can fill the GradientStops collection with a series of GradientStop objects.
Each GradientStop object has an Offset and Color property. You can supply these two values
using the ordinary property-attribute syntax:





Pages:
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135