开发者

Custom painting in WPF view

I have a question about doing the custom painting operations in WPF MVVM View. My case is:

External manipulation of model data happens, and the observable collection of data to be shown is modified (storing some data to be shown in a diagram). I have to react to that change in my view, and custom layout the diagram elements (remove the ones not used, place new ones, calculate positions on diagram canvas). How can I do tha开发者_如何学Pythont, and what would be the best way to do it conform to MVVM pattern? I cant subclass the diagram class, as it is sealed. The diagraming framework used is MindFusion.

Edit: A solution was proposed on MindFusion Support forum, and it works. http://mindfusion.eu/Forum/YaBB.pl?board=wpfdg_disc;action=display;num=1306412889;start=0


Last I checked MindFusion diagraming component for WPF, it supported MVVM through data binding. If you bind the diagram to a ObservableCollection you can then write custom Node Templates which are basically DataTemplate that will render YourDiagramModel items on the diagram panel.

Unlike WinForms you usually don't need to manually refresh or paint control surface in WPF custom controls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜