is there an easy way in the codehind to acces the Text in the picture that is the category on the X axis of the Olap Axis. in the attached sample it would be the text: Ford, Audi
Thank you for your post. I have been looking into your question and you can use two approaches. The first is to get the OlapLabelControl elements and the second is to use the Result of the FlatDataSouce and to access the Member corresponding to the labels of the OlapXAxis.
For the first approach, you can use function similar to the following:
private T GetChildFromType<T>(DependencyObject parent) where T : DependencyObject
T result = null;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
if (VisualTreeHelper.GetChild(parent, i) is T)
return VisualTreeHelper.GetChild(parent, i) as T;
result = GetChildFromType<T>(VisualTreeHelper.GetChild(parent, i));
if (result != null)
To get the OlapLabelPanelHorizontal, which is a child of the XamDataChart and holds the OlapLabelControls. After getting the panel, you can iterate through its Children collection for get each individual OlapLabelControl:
OlapLabelPanelHorizontal labelPanel = GetChildFromType<OlapLabelPanelHorizontal>(DataChart);
if (labelPanel != null)
foreach (OlapLabelControl label in labelPanel.Children)
For the second approach. You can use the FlatDataSouce.Result.ColumnAxis.Tuples (or RowAxis, based on what is the value of OlapAxisSource property of the OlapXAxis). To get the text of the label, you can get the first Member of each Tuple and get its Caption property:
FlatDataSource flat = Resources["OlapFlatDataSource"] as FlatDataSource;
foreach (var tpl in flat.Result.ColumnAxis.Tuples)
Member member = tpl.Members as Member;
I am attaching a sample application that shows how you can implement this approach.
Please let me know if you need any further assistance on the matter.
Developer Support Supervisor - XAML
the sample works great. i think i may have described my issue incorectly. what i am to do is figue out if a series belongs to a certain category when its created. i am current testing code in
I am using the code that is on the sampe site to create the tool tips , i would like the call something like this in there but be able to determine if the series that is being created belongs to that Cateory. is this possible?
it looks like that would work but i think it is not working with 13.2. i do not have 13.1 installed so i can not test with it. using 13.2.20132.1000
DataContext context = (AssociatedObject as Rectangle).DataContext as DataContext;
if (context.Item != null)
the 'Item' is null every time. i am assuming it should have a value?
Thank you for your reply. As I have mentioned, there were an issue in the OlapXAxis, that resulted in Item to be always null and this issue is fixed in the latest service releases of version 13.1 and also in 13.2. I can suggest installing the latest service release of version 13.2 and test the application with it.
I am just checking if you require any further assistance on the matter.
i guess this didnt get fixed in 14.2 either?
This isn't fixed in 15.2 either. It is still null.