Confused and defeated

3 posts, 0 answers
  1. Terry
    Terry avatar
    17 posts
    Member since:
    Mar 2013

    Posted 01 Apr 2013 Link to this post

    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.

  2. Terry
    Terry avatar
    17 posts
    Member since:
    Mar 2013

    Posted 02 Apr 2013 Link to this post

    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.

  3. Petar Mladenov
    Petar Mladenov avatar
    2992 posts

    Posted 03 Apr 2013 Link to this post

    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.
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top