Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
Olap Axis: Tooltips;
posted

Hello,

I'm doing a demo for the customer using NetAdventage for Silverlight 12.1 . During working with Olap Axis I encountered a difficulty setting a tool tip; I need to display {Series Title} : {Value} on mouse over series.

I tried to create a simple binding within  SeriesCreating event handler, but it does not work. Here is the code I use to create the binding:

            ......

            TextBlock textBlock = new TextBlock();

            textBlock.SetBinding(TextBlock.TextProperty, new Binding("Item.Cell.Value") { Source = e.Series //What should be the source for the binding? 

            });

I know that OLAP Axis feature is still CTP, but  I would like to ask you if it is feasible to achieve what I need with the current version.

Thanks in advance,

Alex

 

  • 995
    Verified Answer
    posted

    Hi Alex,

    The data context of the DataChart tooltip is set to a object of the Infragistics.Controls.Charts.DataContext type, so you do not need to set the Source of the Binding.

    I would suggest you try the following:

    private void OlapAxis_SeriesCreating(object sender, SeriesCreatingEventArgs e)

            {

                TextBlock titleTextBlock = new TextBlock();
                Binding seriesTitleBinding = new Binding("Series.Title");
                titleTextBlock.SetBinding(TextBlock.TextProperty, seriesTitleBinding);

                TextBlock valueTextBlock = new TextBlock();
                Binding cellValueBinding = new Binding(string.Format("Item.{0}", e.SeriesInfo.Title));
                cellValueBinding.StringFormat = ": {0}";
                valueTextBlock.SetBinding(TextBlock.TextProperty, cellValueBinding);

                StackPanel sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                sp.Children.Add(titleTextBlock);
                sp.Children.Add(valueTextBlock);
                e.Series.ToolTip = sp;
            }

    Hope this helps.

    Philip