I'm a complete beginner in WPF. I want to create an application such as when the user clicks on it the point clicked should be visualized in some colour(for instance red). Which control should I use? I remember doing something similar in Windows Forms and GDI+ but it was 开发者_开发知识库3 years ago and I haven't done any GUI since.
Thanks for the help.
You have the following options:
- Use a canvas and position Ellipse/Rectangle controls on the canvas that are small enough to look as points. The easiest to program.
- Use an image with WritableBitmap as its image source and draw pixels. Can be very efficient but a bit difficult to program.
- Use a ListBox, and use an Ellipse/Rectangle as its DataTemplate (most compatible with MVVM-type scenarios). Quite easy to program and inefficient.
- Write a custom control that will draw points using low-level geometric primitives (StreamGeometry). This is the hardest to program task.
You can have other options, but I believe the list I mentioned is enough.
精彩评论