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?
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?
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" />
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...