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

Binding Axis Labels

Thread ID:

Created:

Updated:

Platform:

Replies:

80872 May 1,2009 12:30 AM UTC Jul 16,2010 11:42 AM UTC WPF 8
loading
Tags: Chart
Andrew Bancroft
Asked On May 1, 2009 12:30 AM UTC

I'm trying to have an axis label bind to a property in my View Model. The View Model is set as the window Data Context. Here's the XAML:











However, this gives a runtime error:
BindingExpression path error: 'PlotAxisLabels' property not found on 'object' ''ChartAxis'

It looks like the ChartAxis is somehow separated from the visual tree and therefore WPF can't find the parent entities data context?

Or am I doing it wrong?



Pavithra J [Syncfusion]
Replied On May 1, 2009 05:28 AM UTC

Hi Andrew,

Thanks for your interest in Syncfusion products.

We couldn't reproduce the issue mentioned by you. Please refer to the attached sample from the below given link, in which we have also used a ViewModel as DataContext. We could see that the axis header is binding properly.

Sample illustrates

binding ChartAxis


Please let us know if you could still reproduce the issue.

Regards,
Pavithra.J


Andrew Bancroft
Replied On May 1, 2009 05:10 PM UTC

Ah...I was missing the 'DataContext.'. Thx


Pavithra J [Syncfusion]
Replied On May 5, 2009 04:28 AM UTC

Hi Andrew,

Thanks for your update.

Please let us know if you have further queries.

Thank you for your interest in Syncfusion products.

Regards,
Pavithra.J


Abhishek Joshi
Replied On July 14, 2010 07:45 AM UTC

Provided sample link doesn't work! Can you please post the updated link...

Sujitha S [Syncfusion]
Replied On July 15, 2010 03:53 AM UTC

Hi Abhishek,

Thanks for your interest in Syncfusion product.

I have uploaded the sample for your verification.

Please let me know, If you have any queries.

Regards
Sujitha S






VMSample_d3944235.zip

Abhishek Joshi
Replied On July 15, 2010 09:02 AM UTC

Thanks Sujitha, thats exactly what I was looking for.

I am bit curious why we need to do this to bind a textbox inside chart axis -



why doesn't this works



This works outside the Syncfusion chart?

Poorani Idhaya Bala M.A [Syncfusion]
Replied On July 16, 2010 11:35 AM UTC

Hi Abhishek ,

Thanks for choosing Syncfusion Products.

DataContext of the axis header is Chart Axis instead of the ChartViewModel.

I have modified the sample to illustrate this. I have added a message box with the Context menu details in loaded event.

When we use the below code,



the header value is not binded. Because the chart axis DataContext (Chart Axis ) doesn't have the property named "PrimaryAxisName".

If you use the below code,



the primary axis name will be binded to the text block,because the datacontext of the chart axis is ChartViewModel and it has the property named "PrimaryAxisHeader".

Please test this sample and let you know if you have any questions.

Thanks,
Poorani









VMSample_958bd04c.zip

Poorani Idhaya Bala M.A [Syncfusion]
Replied On July 16, 2010 11:42 AM UTC

Hi Abhishek ,

Sorry for the previous post. I have missed to mention the chart axis header. Please find the update as below.

DataContext of the axis header is Chart Axis instead of the ChartViewModel.

I have modified the sample to illustrate this. I have added a message box with the Context menu details in loaded event.

When we use the below code,



the header value is not binded. Because the axis header's DataContext (Chart Axis ) doesn't have the property named "PrimaryAxisName".

If you use the below code,



the primary axis name will be binded to the text block,because the data context of the chart axis is ChartViewModel and it has the property named "PrimaryAxisHeader".

Please test this sample and let you know if you have any questions.

Thanks,
Poorani


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

;