Binding Axis Labels
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?
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?
SIGN IN To post a reply.
8 Replies
PJ
Pavithra J
Syncfusion Team
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
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
AB
Andrew Bancroft
May 1, 2009 05:10 PM UTC
Ah...I was missing the 'DataContext.'. Thx
PJ
Pavithra J
Syncfusion Team
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
Thanks for your update.
Please let us know if you have further queries.
Thank you for your interest in Syncfusion products.
Regards,
Pavithra.J
AJ
Abhishek Joshi
July 14, 2010 07:45 AM UTC
Provided sample link doesn't work! Can you please post the updated link...
SS
Sujitha S
Syncfusion Team
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
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
AJ
Abhishek Joshi
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?
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?
PI
Poorani Idhaya Bala M.A
Syncfusion Team
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
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
PI
Poorani Idhaya Bala M.A
Syncfusion Team
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
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
SIGN IN To post a reply.
- 8 Replies
- 5 Participants
-
AB Andrew Bancroft
- May 1, 2009 12:30 AM UTC
- Jul 16, 2010 11:42 AM UTC