How to customize the Tooltip of the Cube Dimension Browser
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