Hi team,
Hello elinder,
With the way the tooltip is defined, it doesn't need to be placed on every StackedFragmentSeries. It only needs to be placed on the StackedColumnSeries. This is because the template already displays the values presented by the StackedFragmentSeries, so there's no need to place a tooltip on each individual fragment series if they are all going to show the same data anyway.
The reason the tooltips aren't working is because DataTemplates cannot be assigned to the ToolTip directly. The tooltip needs to be assigned to a control and inside that control you can place something like a ContentPresenter to use your template.
<ig:StackedColumnSeries.ToolTip> <Grid> <ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource TooltipTemplate}"/> </Grid> </ig:StackedColumnSeries.ToolTip>
I have attached a modified version of your sample that you can take a look at. Let me know if you have any questions.
Hi elinder,
Let me know if you have any further questions on this matter.
Hi Rob,
Your legend solution is great, but still we have some issues with other two points.
1. We want to display StackedFragmentSeries own value on mouse over, now i was defined tooltip of every StackedFragmentSeries, due to this approach we achieve desired results, but following this approach our code is redundant, we have almost 10 series and every series contains same tooltip code, only item.value changed, we want to replace this approach using DataTemplate like in previous sample application.
2. We tried to solve title binding according to your approach, but still not worked. Can you please modify the sample as you explained it in your previous reply?
I've attached a modified sample application.
It turns out I was wrong about the DataContext for your series Title binding. The StackedFragmentSeries object derives from DependencyObject so it doesn't even have a DataContext. This means it isn't going to inherit it's "parent's" DataContext, so your binding doesn't have any source. In order to bind this property, you are going to need to use a StaticResource binding. I've attached a modified version of the sample you sent me with the changes.
Regarding the datatemplate stuff, the templates you originally had threw me off because they used values from each series. So I was wondering why you needed to display a template for each StackedFragmentSeries if the content in the template was always the same. But your new sample shows that you changed the bindings to include the appropriate values based on the series. As such, I have modified your sample. It's not possible to assign DataTemplates directly to the series ToolTip property as it is expecting a UI control. The best you can do is move your templates into your Resources collection and then use the XAML code I sent you earlier on Oct 3rd. The code effectively does the same exact thing as before but it removes the templates from inside the XamDataChart XAML and allows you to put them into a resource dictionary so you can clean up the code some.
Your provided solution is great, We have one more issue with StackedFragmentSeries ValueMemberPath.
We have almost 10 StackedFragmentSeries, and we have a class that contains values like Value1 to Value10, and these values are assigned to StackedFragmentSeries ValueMemberPath (in sample application we use Value1, Value2 and Value3). Its working fine. But we want to use ExpandoObject to avoid defining large number of object properties, please see the employee, manager example from the following link
http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject(v=vs.100).aspx
By using this approach, XamDataChart is not displaying data, but this approach is working fine with ListBox.
can you please modify the sample by using ExpandoObject ?
The XamDataChart uses reflection in order to get the property values using the ValueMemberPath string, and reflection can't be used to get values from an ExpandoObject. Please see the following forum thread regarding this: http://ko.infragistics.com/community/forums/t/48732.aspx
If you would like to see built in support for dynamic objects in the XamDataChart, I recommend that you submit this as a product idea at: http://ideas.infragistics.com