Love Silverlight diagrams but need to be able to add data binding to the shapes

3 posts, 0 answers
  1. Soven
    Soven avatar
    16 posts
    Member since:
    Sep 2007

    Posted 18 Feb 2013 Link to this post

    I have few questions/ enhancements requests.

    a) Is it a lot of work to make each shape data-bind to pre-defined data source for that diagram?

    b) How easy is it to add custom properties to each shape? Just to illustrate my points, I want to have some kind of restrictions on what shapes can connect to a particular shapes and whats the maximum connectors allowed. If requirements are not met, I would like to have background color of shape to change to certain color to let user know that certain requirements are not met.

    c) Just to get go along with question (b), how easy it is to add custom events (server side function) to these shapes. Just to illustrate my point here, lets say I have a custom shape called - "Concatenation". This shape requires 2 "String" Shapes as Inputs and 1 Output. So 3 connectors are required too. This shape will have custom event that will take 2 incoming values of those input shapes and concatenate together and send that to output shape.

    Plus, once a diagram is designed, I want to use this diagram as reporting tool ( in telerik reporting for example) where we supply data source and outcome is different for each data row. And outcome can be collected as csv file too in addition to pdf generation etc.

    If this can be done easily and is the existing functionality, let me know where can I find documentation about this. If this requires major feature request, I am willing to pay for this feature.
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 21 Feb 2013 Link to this post

    Hi Soven,

    Thank you for contacting us.

    Working with the RadDiagram in MVVM scenario is easy and does not require a lot of work.  For more information you can refer to these articles: DataBinding, RadDiagram in MVVM, Using StyleSelectors in MVVM. When you use the RadDiagram in MVVM scenario you can take advantage of our predefined ViewModels like NodeViewModelBase and LinkViewModelBase which expose some basic properties suitable for binding to RadDiagramShapes' and RadDiagramConnections' properties (for example Content, Source, Target, Height, Width, RotationAngle). Also, you are able to add custom properties by creating classes deriving from our ViewModels. While creating custom view models allows you to incorporate custom business rules inside them you could also easily create custom shapes (objects deriving from RadDiagramShape) and customize their behavior and appearance.

    On the other hand the RadDiagram exposes events that can be used to customize (restrict) the connections that the user creates. For more detailed information about the events you can refer to the following articles: DiagramEvents, ItemsEvents.

    However, I am not quite sure I have managed to fully understand what you have in mind with the following:

     "take 2 incoming values of those input shapes and concatenate together and send that to output shape".

     Are you describing some kind of process execution (expression calculation)? If so, could you please provide us a bit more info on the topic (or the use case)?

    Furthermore, you can refer to this article - describing the export feature of the RadDiagram. Our new help resources coming up next week will also explain our Export to HTML feature. It is actually JavaScript library which enables you to export the RadDiagram in an html file. In the mean time, You can try out  this feature in our Demos.

    Hope this helps. I am looking forward to hearing from you.

    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Egemen
    Egemen avatar
    34 posts
    Member since:
    Apr 2012

    Posted 24 Mar 2013 Link to this post


    I have got some custom shape(templated control) and  I try to understand how i can bind my ObserservableCollection<customshape> to my raddiagram by using graphsource. My customshape inherits already from RadDiagramShapeBase and i dont know how i can add ?
    When i create a CustomShape class like this, it doesn't work...

     public class CustomShape : NodeViewModelBase
            public CustomShape(ImageElement elt)
                this.Content = elt.Content;

    Can you tell me please how i can bind my ObserservableCollection ?

    Best regards

Back to Top