MVVM in a canvas with usercontrols

Posted by Mauro Destro on Stack Overflow See other posts from Stack Overflow or by Mauro Destro
Published on 2009-04-23T13:44:03Z Indexed on 2010/03/29 11:13 UTC
Read the original article Hit count: 506

Filed under:
|
|

I have a MVVM WPF application that basically wants to be a single line diagram designer for an electrical distribution network.

I have a canvas that must contains transformers, circuit breaker, lines and cables.

My big problem is the design... How can i start?

I think about a DesignerView, DesignerViewModel that contains an ObservableCollection of IDesignerItemViewModel that is my base class for all the element. But in this case I have to use ItemsControl to bind the content of the canvas to my collection but the pros is that I don't have to create usercontrol for each element but i'll solve most of the problems with DataTemplate (i suppose). Each element viewmodel mantain a link to a model persisted in a repository where i mantain my logical tree.

Any hint about how to proceed, I have looked at many DiagramCanvas example but all of those use simple items most like simple rectangle...

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm