Exploring Creativity with Design / Graphics / Technology
Quick Tip to Get a Striped Background
If you are looking to apply a striped background to any of your
elements, you don’t need to rely on a PNG tile. Instead you can do it
all in Xaml, using a LinearGradientBrush.
Suppose you want to color a large Rectangle with a 45 degree striped
background, something like:
You can do this with a LinearGradientBrush, like so:
The two GradientStops at 0.5 give you the split in colors. If you
want more, say a three-color split, add the GradientStops at 0.33
and 0.66
The SpreadMethod of Repeat, gives you the repeating pattern
A RelativeTransform on the gradient allows you to tweak the width
and orientation of the stripes. Here we are only controlling the
width. You can add a RotateTransform to orient your stripes.
Few more examples
Here are a few more examples just to get you more creative…