Articles in this section
Category / Section

How to rename the caption inside the SplitButton in an AxisElementBuilder?

1 min read

You can change the name on the SplitButton present in the AxisElementBuilder as per your requirement. This can be done by simply iterating the MetaTreeNode collection besides each axis and by changing the value besides the Caption property. The following code displays the same.

C#

public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            ……
            ……
            //Triggers the Loaded event of the OlapClient
            this.olapClient.Loaded += new System.Windows.RoutedEventHandler
 (olapClient_OnLoaded);
        }
void olapClient_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            //Triggers the AxisElementBuilder event to change the caption of the SplitButton
            this.olapClient.OlapDataManager.AxisElementChanged += new Syncfusion.OlapSilverlight.Manager.AxisElementChangedEventHandler(OlapDataManager_AxisElementChanged);
        }
void OlapDataManager_AxisElementChanged(object sender, AxisElementChangedEventArgs e)
        {
            //Processes the MetaTreeNodes of an AxisElementBuilderRow
            foreach (MetaTreeNode node in olapClient1.AxisElementBuilderRow.MetaTreeNodes)
            {
                    node.Caption = "Give the name which has to be displayed";
            }
            //Processes the MetaTreeNodes of an AxisElementBuilderColumn
            foreach (MetaTreeNode node in olapClient1.AxisElementBuilderColumn.MetaTreeNodes)
            {
                    node.Caption = "Give the name which has to be displayed";
            }
            //Processes the MetaTreeNodes of an AxisElementBuilderSlicer
            foreach (MetaTreeNode node in olapClient1.AxisElementBuilderSlicer.MetaTreeNodes)
            {
                    node.Caption = "Give the name which has to be displayed";
            }
        }
    }

VB

Partial Public Class MainPage
    Inherits UserControl
    Public Sub New()
        InitializeComponent()
        ……
        ……
        ‘Triggers the Loaded event of the OlapClient
        Me.olapClient.Loaded += New System.Windows.RoutedEventHandler(olapClient_Loaded)
    End Sub
Private Sub olapClient_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
        ‘Triggers the AxisElementBuilder Event to change the caption of the SplitButton
        Me.olapClient.OlapDataManager.AxisElementChanged += New Syncfusion.OlapSilverlight.Manager.AxisElementChangedEventHandler(OlapDataManager_AxisElementChanged)
End Sub
Private Sub OlapDataManager_AxisElementChanged(ByVal sender As Object, ByVal e As AxisElementChangedEventArgs)
        ‘Processes the MetaTreeNodes of an AxisElementBuilderRow
        Dim node As MetaTreeNode 
        For Each node In olapClient1.AxisElementBuilderRow.MetaTreeNodes 
                node.Caption = "Give the Name which has to be displayed"
            End If
        Next
        ‘Processes the MetaTreeNodes of an AxisElementBuilderColumn
        Dim node As MetaTreeNode 
        For Each node In olapClient1.AxisElementBuilderColumn.MetaTreeNodes
                node.Caption = "Give the Name which has to be displayed"
            End If
        Next
        ‘Processes the MetaTreeNodes of an AxisElementBuilderSlicer
        Dim node As MetaTreeNode
        For Each node In olapClient1.AxisElementBuilderSlicer.MetaTreeNodes
                node.Caption = "Give the Name which has to be displayed"
            End If
        Next
    End Sub
End Class

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