This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, can I create a view model for tool box, and in the xaml the DiagramToolBox bind the view model, so that I can generate the tool box programatically. Thanks. |
|
|
Hello jzhou Unfortunately the groups property of the DiagramToolBox can not be set so you won't be able to bind to it. We can not change this right now as it will be a change to the current API, but I've noted this down as a high priority change to make for the next version. Despite this, there are still ways to stick to the MVVM pattern. One idea for example will be to write a class that extends our DiagramToolBox control and include some kind of ItemsSource property that you can bind to. When this property changes or the items in the collection change, you can add/remove DiagramToolBoxGroup instances to/from the Groups collection. The ItemsSource property of the DiagramToolBoxGroups do support binding, so when you create new instances of the DiagramToolBoxGroups, you can set up a binding in code to the appropriate property on your model objects. By doing this, all the visual element setup will be within your extended toolbox custom control, and the only link between the tool box and your model will be the binding to the property you implement on this extended control. Another similar approach would be to wrap up this logic into an attached behavior which you can then attach to the normal DiagramToolBox control. Try out whichever of these two approaches you like the sound of and let me know if you need help with some of the implementation. My apologies for this inconvenience. Jason Fauchelle |
|