Category / Section
How to hide an axis inside AxisElementBuilder of OLAP Client?
1 min read
You can hide a particular axis, either a Column, a Row or a Slicer, inside the AxisElementBuilder as shown in the following code example. In this example, the Column axis of the AxisElementBuilder is hidden.
C#
public MainWindow() { try { InitializeComponent(); …… …… …… HideColumnAxisElementBuilder(this.olapClient1.AxisElementBuilderColumn); } catch (Exception ex) { MessageBox.Show(ex.Message, "Data will not be loaded properly"); } } void HideColumnAxisElementBuilder(DependencyObject dObj) { DependencyObject aebObject = VisualTreeHelper.GetParent(dObj); if (objec1.ToString() == "System.Windows.Controls.Border") { if (count < 2) { count++; if (count == 2) { (aebObject as System.Windows.Controls.Border).Visibility = System.Windows.Visibility.Collapsed; } if (count < 2) HideColumnAxisElementBuilder(aebObject); } } else { if (count < 2) HideColumnAxisElementBuilder(aebObject); } }
VB
Private Function MainWindow() As Public Try InitializeComponent() …… …… …… HideColumnAxisElementBuilder(Me.olapClient1.AxisElementBuilderColumn) Catch ex As Exception MessageBox.Show(ex.Message, "Data will not be loaded properly") End Try End Function Private Sub HideColumnAxisElementBuilder(ByVal dObj As DependencyObject) Dim aebObject As DependencyObject = VisualTreeHelper.GetParent(dObj) If objec1.ToString() = "System.Windows.Controls.Border" Then If count < 2 Then count = count + 1 If count = 2 Then (aebObject as System.Windows.Controls.Border).Visibility = System.Windows.Visibility.Collapsed End If If count < 2 Then HideColumnAxisElementBuilder(aebObject) End If End If Else If count < 2 Then HideColumnAxisElementBuilder(aebObject) End If End If End Sub