Articles in this section
Category / Section

How to customize the Tooltip of the Cube Dimension Browser

1 min read

We can customize the tooltip of the Cube dimension browser by hooking up the MouseOver event of the CubeDimensionBrowser. We have provided the option to customize the tooltip text of cube dimension browser and this can be achieved by following code snippet.

C#

public MainPage()

        {

            InitializeComponent();

            this.DataContext = new ViewModel.ViewModel();

            this.olapClient.Loaded += (send, e) =>

            {

                this.olapClient.CubeDimensionBrowser.MouseMove += new System.Windows.Input.MouseEventHandler(CubeDimensionBrowser_MouseMove);

            };

        }

 

        void CubeDimensionBrowser_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)

        {

            

            if (this.olapClient.CubeDimensionBrowser.ItemsSource is MetaTreeNodeCollection)

            {

                object obj = null;

                 if (e.OriginalSource is TextBlock)

                {

                    var a = (e.OriginalSource as TextBlock);

                    //ToolTipService.SetToolTip(a, a.Text);

 

                    var itemSource = (this.olapClient.CubeDimensionBrowser.ItemsSource as MetaTreeNodeCollection)[0];

 

                    foreach (var item in itemSource.ChildNodes)

                    {

                        if (item.Caption == a.Text)

                        {

                            obj = item;

                            break;

                        }

                    }

                    if (obj != null)

                    {

                        TextBlock tb = new TextBlock();

                        tb.Text = (obj as MetaTreeNode).NodeType + " : " + (obj as MetaTreeNode).Caption;

                        ToolTipService.SetToolTip(a, tb);

                    }

                    else

                    {

                        if(a.Text == "Growth in Customer Base")

                            ToolTipService.SetToolTip(a, "Shows the KPI for Growth in Customer Base");

                    }

                }

            }

        }

 

              

Figure: CubeDimension Browser with custom tooltip

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied