This is a migrated thread and some comments may be shown as answers.

Confused and defeated

2 Answers 106 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 01 Apr 2013, 11:20 PM
Hello all,

I have been trying to implement RadDiagram in an MVVM way, using Caliburn.Micro and I'm coming to the conclusion that this just doesn't fit well with the Telerik controls architecture. I would love it if someone can prove me wrong.

I've looked at every sample app from these forums and Telerik's help, often confused at the reams of <style> code I have to wade through to make sense of anything, and I've still not found a simple answer to my issues.

The following are my goals:

  • Use UserControls, not Styles, to implement my shapes
- I like that the UserControls can easily be designed in Blend or Visual Studio
- I like that the visual implementation is modular within each UserControl
- unless someone can propose an elegant, organized solution using styles/ResourceDictionaries
  • Use MVVM architecture and Caliburn.Micro to locate views for the viewmodels (viewmodel-first approach)
- All the examples of MVVM implementation I've seen seem clunky, but maybe I'm just not seeing the forest through the trees.
  • Have multiple custom shapes on a RadDiagram
- Unless I'm missing something, it appears that you must override the Template for type:RadDiagramShape to show your custom control visual. I don't like having this xaml mixed in with the main RadDiagram xaml. I'd like to separate it into the custom shape xaml for clarity.
- it also appears that I need to create a custom RadDiagram control and override IsItemItsOwnShapeContainerOverride (etc),
instantiating each custom shape depending on the type of the object passed in.


At this point, I'm so confused by the myriad of examples of ways to implement things, that I'm looking for a very simple example of complete view/viewmodel separation (no code behind, unless just to set the viewmodel, if not using an MVVM framework), multiple custom shapes support, well-organized xaml/code into meaningful, logical files that can be designed in VS or Blend.

I'm also willing to admit that maybe I'm just missing something that brings everything together nicely. I hope someone can point me in the right direction.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Terry
Top achievements
Rank 1
answered on 02 Apr 2013, 04:01 PM
One thing I have considered is that perhaps Themes become more difficult by using UserControls rather than Styles to template controls.

I don't have experience with custom Themes, so I'd love to hear your opinion on this point.

Thanks!
0
Petar Mladenov
Telerik team
answered on 03 Apr 2013, 10:01 AM
Hi Terry,

 We are not sure we completely understand your Styles/Themes question, could you please elaborate more on it? 
As for the UserControls/CustomShapes/MVVM question. We highly believe this requirement is possible with RadDiagram Framework only. Attached is a sample project demonstrating:

  • Custom UserControls (Views)
  • DataTemplates for every View
  • ShapeTemplateSelector to connect every ViewModel with its DataTemplate
  • Shape Serialization/Deserialization process saving/loading the DataContext/ContentTemplate of the shapes.
We hope this will help you proceed in a right direction.
Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Terry
Top achievements
Rank 1
Answers by
Terry
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or