Blend Bits 6: Paths Are Your Friend (2)

Once you’ve got a Path or two you can have fun with them by combining them in lots of different ways.

For instance, if we take these 2 Rectangles that have been converted into Paths;

image

then I can make them into a single Path that can then be manipulated “as one” by simply selecting them both and using the right mouse menu;

image

and now they are one object – you can tell because now they are one Path they can only take on a single Brush;

image

The other interesting menu option on that right mouse menu here is the “Combine” option. I can play around with that with these 2 Paths – you’ll find the triangle on your Assets window under Shapes and then I just used the right mouse menu to turn that into a Path again;

image

I can then use that right mouse menu to Unite, Divide, Intersect, Subtract and Extract Overlap;

imageimageimageimageimage

in order to make new Paths again.

When you’ve got a Path, there’s some interesting stuff that you can do with it including using it for clipping or for layout.

Having taken a TextBlock, added Text and then converted it to a Path I can easily fill that Path with an ImageBrush or a VideoBrush – in Blend I can do that by selecting the Path, going over to its Fill Brush and then selecting an image;

image

or I could take an alternate approach. With arbitrary content like this DataGrid that I dropped onto the design surface and filled with sample data;

image

I can select both the Path and the DataGrid and use the Path to clip the DataGrid ( think “arbitrary content” here rather than “DataGrid” );

image

leaving a kind of interesting but probably not very useful DataGrid;

image

sometimes you want a “stencil” like effect so, for instance, here I’ve got an Image, a Rectangle (semi-transparent) and my text as a Path.

image

I could use the right mouse menu to subtract the text Path from the Rectangle and then overlay that remaining “stencil” onto my Image as in;

image

There’s lots of fun to be had with Paths Winking smile As I said earlier, you can also use them for Layout with Blend 4 so you can take some Paths like the one I’ve drawn here;

image

and right mouse on it;

image

and that will throw in a PathListBox on your behalf and use the Path as one of the Paths that the ListBox will lay its items out along that Path. I just threw some small red Hexagons into my PathListBox to show the Layout;

image

but you can then go and visit the properties of the PathListBox and have lots of fun with settings over there;

image

As I said, Paths are fun Smile