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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Issue with Data Binding business objects to the diagram model.

Thread ID:

Created:

Updated:

Platform:

Replies:

96804 Oct 7,2010 06:04 AM UTC Oct 21,2010 04:57 AM UTC WPF 1
loading
Tags: Diagram
Administrator [Syncfusion]
Asked On October 7, 2010 06:04 AM UTC

I am evaluating the data binding feature with directed-tree layout and am unable to make it work. I would really appreciate if you can provide me a working sample of the data binding or let me know what am I doing wrong.

Here is what I have so far

XAML -


















Orientation="TopBottom"
x:Name="diagramModel"
SpaceBetweenSubTrees="100"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource dataTemplate}">









C# -

public MainWindow()
{
InitializeComponent();

List CountrySalesList = new List();

CountrySalesList.Add(new CountrySale() { Name = "US" });

CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "New York", Revenue = 2353 });

CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "Texas", Revenue = 3453 });

CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "California", Revenue = 8456 });

this.DataContext = CountrySalesList;
}


Thanks
KK



Jegan R [Syncfusion]
Replied On October 21, 2010 04:57 AM UTC

Hi Kiran,

Thanks for evaluating Syncfusion products.

Currently, ItemSource for DiagramModel can be specified in two ways, either by binding it to a StaticResource or by directly assigning an object to ItemSource in the CodeBehind as shown in the following code snippet.

Code Snippet:

public MainWindow()
{
InitializeComponent();
List CountrySalesList = new List();
CountrySalesList.Add(new CountrySale() { Name = "US" });
CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "New York", Revenue = 2353 });
CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "Texas", Revenue = 3453 });
CountrySalesList[0].RegionalSales.Add(new RegionSale() { Name = "California", Revenue = 8456 });
this.diagramModel.ItemsSource = CountrySalesList;
}

Please refer the sample form the following link.

Sample Link: http://files.syncfusion.com/Support/Diagram.WPF/Samples/72991/DataBindingSample.zip

This is because DiagramModel class just extends DependencyObject, so ItemsSource cannot be binded to any property. However, we have fixed this issue and this fix will be available in our Volume 4 2010 release, which is tentatively scheduled to be held on the last week of October 2010.

Also this forum is a duplicate of incident #72991, please follow up with this incident.

Please let us know if there are any concerns.

Regards,
Jegan


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;