Articles in this section
Category / Section

How to customize the images in the OlapClient control.

1 min read

The OlapClient ToolBar images, OlapChart and OlapGrid ToolBar images can be customized with new images. This can be achieved by creating a Template for those images and assigning those templates to corresponding buttons. Please refer the below code snippet to know how to customize the OlapClient images.

  1. Creating Templates for images

XAML

<UserControl.Resources>

        <DataTemplate x:Key="AddReport">

                <Image Visibility="Visible" Source="Add_Report.png" />

        </DataTemplate>

        <DataTemplate x:Key="ShowLegend">

            <Image Visibility="Visible" Source="ShowChartLegend.png" />

        </DataTemplate>

        <DataTemplate x:Key="GridCellToolTip">

            <Image Visibility="Visible" Source="GridCellToolTip.png" />

        </DataTemplate>

</UserControl.Resources>

 

  1. Setting those templates to the corresponding button.

C#

 

private OlapToolBarButton btnToolBar;

private void OlapClientWindow_Loaded(object sender, RoutedEventArgs e)

        {

            SetImage(this.OlapClient.OlapClientToolBar, "PART_New", "AddReport");

            SetImage(this.OlapClient.OlapChartToolBar, "PART_ShowLegend", "ShowLegend");

            SetImage(this.OlapClient.OlapGridToolBar, "PART_VToolTip", "GridCellToolTip");

          

        }

 

        private void SetImage(OlapToolBar olapToolBar, string BtnName, string TemplateName)

        {

            DataTemplate myTemplate = (DataTemplate)this.Resources[TemplateName];

            for (int i = 0; i < olapToolBar.Items.Count; i++)

            {

                if (olapToolBar.Items[i] is OlapToolBarButton)

                {

                    btnToolBar = olapToolBar.Items[i] as OlapToolBarButton;

                    if (btnToolBar.Name == BtnName)

                    {

                        btnToolBar.ContentTemplate = myTemplate;

                        break;

                    }

                }

            }

        }

 

 

 

Figure: OlapClient ToolBar image for “NewReport” has been customized

 

Figure: OlapChart ToolBar image for “ShowLegend” has been customized

 

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