tags:

views:

105

answers:

3

Hi, I want to draw (via mouse drag) some rectangles onto a canvas. Normally I'd use the Graphics class and FillRectangle on mousemove.

Does anyone have any good resources for doing this in WPF?

+1  A: 

Hi, tutorial here

Ric Tokyo
A: 

Use the Rectangle class. And set the Fill dependency property to the brush you want.

Here's a quick example in XAML

<Rectangle Fill="Black" Height="100" Width="200" />
Scott Weinstein
A: 

Found the answer, basically it's best to put a Rect and RectangleGeometry into a Path, add the Path to the canvas and then change the Rect data on mousemove.

Something like that at least...

Karl R