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

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

2 Answers 67 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Soven
Top achievements
Rank 2
Soven asked on 18 Feb 2013, 04:03 PM
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 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 21 Feb 2013, 04:43 PM
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.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Egemen
Top achievements
Rank 1
answered on 24 Mar 2013, 06:14 PM
Hi,

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


Tags
Diagram
Asked by
Soven
Top achievements
Rank 2
Answers by
Pavel R. Pavlov
Telerik team
Egemen
Top achievements
Rank 1
Share this question
or