We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Databinding SfDiagram

We're using the Syncfusion Controls for WinRt and we're trying to build up the nodes/connectors for an SfDiagram programatically in a ViewModel. We're also using Prism to bind it all together.

Our ViewModel exposes an SfDiagram property and we're binding like this

<syncfusion:SfDiagram Tool="None" Grid.Row="1" DataContext="{Binding InvestigationDiagram}" Nodes="{Binding Nodes}" Connectors="{Binding Connectors}" >

Yet this is not working. I am seeing the following binding errors

Error: Converter failed to convert value of type 'System.Collections.ObjectModel.ObservableCollection1[[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' to type 'IIterable1<Object>'; BindingExpression: Path='Nodes' DataItem='Syncfusion.UI.Xaml.Diagram.SelectorViewModel, Syncfusion.SfDiagram.WinRT, Version=11.3010.0.30, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'; target element is 'Syncfusion.UI.Xaml.Diagram.Selector' (Name='null'); target property is 'Nodes' (type 'IIterable1').

[Above error or a variation 6 times]

Error: Converter failed to convert value of type 'System.Collections.ObjectModel.ObservableCollection1[[Syncfusion.UI.Xaml.Diagram.Node, Syncfusion.SfDiagram.WinRT, Version=11.3010.0.30, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89]], System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' to type 'IIterable1'; BindingExpression: Path='Nodes' DataItem='Syncfusion.UI.Xaml.Diagram.SfDiagram'; target element is 'Syncfusion.UI.Xaml.Diagram.SfDiagram' (Name='null'); target property is 'Nodes' (type 'IIterable1<Object>'). Error: Converter failed to convert value of type 'System.Collections.ObjectModel.ObservableCollection1[[Syncfusion.UI.Xaml.Diagram.Connector, Syncfusion.SfDiagram.WinRT, Version=11.3010.0.30, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89]], System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' to type 'IIterable1<Object>'; BindingExpression: Path='Connectors' DataItem='Syncfusion.UI.Xaml.Diagram.SfDiagram'; target element is 'Syncfusion.UI.Xaml.Diagram.SfDiagram' (Name='null'); target property is 'Connectors' (type 'IIterable1'). `

We have also tried to bind the LayoutManager but got similar issues.

I now assume we're simply going about this the wrong way.

So, how do we build some data in a ViewModel and then bind to an SfDiagram?


3 Replies

RT Ramya Thirugnanam Syncfusion Team November 8, 2013 11:38 AM UTC

Hi Colin,

We are able to reproduce the reported issue” binding errors” with SfDiagram. It seems to be framework problem. However, we have provided a sample with workaround to resolve this issue. Please refer to the sample from the attachment.

Sample Details:

The same type of properties throws binding errors in binding. To avoid this binding error, we have created the dummy properties in View with type used in Viewmodel for Nodes and Connectors Properties. And also we have added one more property with type of “object” in view to resolve the binding error from SelectorViewModel in the provided sample.

[c#]

public ObservableCollection<object> dummy3 { get; set; }


Please let us know if you have any questions about this.
Regards,
Ramya



114241_3e29101d.zip


SR Srikanth April 23, 2018 11:23 AM UTC

Hi Team,

Looks like url of the above sample is broken.

Can you please provide the url ? 

Thanks,
Sri.


KR Karkuvel Rajan Shanmugavel Syncfusion Team April 24, 2018 06:27 AM UTC

Hi Srikanth, 
 
This issue is applicable only in our older version, we have addressed this issue our recent release. We have changed SfDiagram.Node property from type ‘IEnumerable<Object>’ to type ‘Object’. Hence, this binding error will no more appear.  If this issue is still reproduced please provide sample, code snippet, console error so that we can check and provide you a solution. 
 
Regards, 
Karkuvel Rajan.S  
 


Loader.
Live Chat Icon For mobile
Up arrow icon