views:

135

answers:

2

I'd like to try to create a diagram making tool (something like entity-relation diagram you can create in SQL Server 2005, or class diagrams you can do in Microsoft Visual Studio)

Ie. I'd like to create boxes, put text in them, be able to edit this text and draw lines between boxes.

I never did this kind of programming before so I don't know where to start.

Do I use XAML or create a canvas and go into graphics programming?

I know there are some diagram tools out there but I'd really like to find out of these things by doing it myself.

+2  A: 

WPF/XAML are a great place to start for something like this. You'll want to study WPF in general, with a focus on custom controls (for tables) and drawing lines (for the relationships.)

Dave Swersky
+1  A: 

The rendering engine you pick is somewhat arbitrary - you're going to have to do a lot of work no matter what framework you use.

Having implemented such a system in C# and WinForms, I can honestly say that's a bad route to go. Stick to WPF/Silverlight. Going with trends, write a Silverlight 4 app so you can deploy to desktops on multiple platforms.

I found that there are a lot of high-level decisions that you have to make that are even more important than which rendering engine you use. Some of these are:

  • How much do you need to zoom and pan around?

    • Do you want continuous zoom so that you can do neat animations to the data?
    • Do you need to be able to pan with just the mouse?
    • How will you distinguish pan movements from dragging around boxes and handles?
    • Will you change the layout of content in the boxes dependent upon the current zoom level? or will you rely on font scaling?
  • Do you need grouping? Once you get a few tables on the screen you will soon realize that being able to hide some detail is useful. Being able to group boxes and to show that group in iconic form as "meta" box allows the user to get rid of unwanted distractions.

  • Do you need search? Again trying to combat the "too much on the screen" problem, it's good to have a search box that hides everything that doesn't match the search (gray out, hide, etc.)

  • How will the user interact with the keyboard. Since your audience can include programmers, you're going to want to give a lot of thought to making all your diagrams editable with just the keyboard. This means things like handling focus intelligently along with which hot keys to use.

Frank Krueger