BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
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.ObservableCollection
1[[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 'IIterable
1').
[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 'IIterable
1'; 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.ObservableCollection
1[[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 'IIterable
1'). `
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?
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