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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Access to underlying object in Data Template

Thread ID:

Created:

Updated:

Platform:

Replies:

87886 Jul 13,2009 03:22 AM UTC Mar 14,2011 08:31 AM UTC WPF 5
loading
Tags: Chart
Marc Glick
Asked On July 13, 2009 03:22 AM UTC

Is there any way to access the underlying data item a chart is bound to in a data template.

Right now it seems as the only data available is what you bind via BindingPathX and BindingPathsY. If my underlying object has other properties I wish to visualize on the chart, how can I do that?


Saradha [Syncfusion]
Replied On July 13, 2009 09:25 AM UTC

Hi Marc,

Thanks for your interest in Syncfusion products.

We could access the underlying Data Source and retrieve its properties. Please refer to the sample from the below given link.
http://files.syncfusion.com/support/Chart.WPF/7.3.0.6/F87886/main.htm

It uses a Data Template for Colum chart. A converter is used in this DataTemplate to retrieve the Data Source and its properties.

Please let me know if I have misunderstood your requirement.

Thank you,
K. Saradha Devi

Marc Glick
Replied On July 13, 2009 03:07 PM UTC

Thanks for the prompt response. It also seems as the Tag property holds a reference to the underlying bound object. Can I rely on this. I prefer not having to use ValueConverters for simple tasks. For example, re-templating the candle to render candles with different fills.

Assume I extend the StockDataPoint class from your FinancialChart sample, and add an IsUp property.

Then I can retemplate the chart series as follows using
"CorrespondingPoints[0].DataPoint.Tag.IsUp"?



StrokeThickness="{Binding StrokeThickness}"
X1="{Binding HighX}" X2="{Binding LowX}"
Y1="{Binding HighY}" Y2="{Binding LowY}" />
Canvas.Left="{Binding X}" Canvas.Top="{Binding Y}"
Width="{Binding Width}" Height="{Binding Height}"
Stroke="{Binding Stroke}" StrokeThickness="{Binding
StrokeThickness}" ToolTip="{Binding ToolTip}" >





Saradha [Syncfusion]
Replied On July 14, 2009 06:14 AM UTC

Hi Marc,

Thanks for your interest in Syncfusion products.

We could also write templates and access underlying data source values with tag property. We have created a sample, with StockDataPoint class with IsUp property and applied the same template provided by you.

Please refer to the modified sample in the below given link.
http://files.syncfusion.com/support/Chart.WPF/7.3.0.6/F87886/main.htm

Please let us know if you have further queries.

Regards,
K. Saradha Devi

John Fairbanks
Replied On March 10, 2011 08:08 PM UTC

These sample links don't seem to work any more... I'd love to see these samples if I could.


Saravanan A [Syncfusion]
Replied On March 14, 2011 08:31 AM UTC

Hi John,

Thanks for your interest in Syncfusion products.

Please find last sample provided for this forum in below location.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Accessing_Data_source_Properties1482509436.zip

Please let us know if you need any further clarifications.

Regards,
Saravanan



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;