We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the images in the OlapClient control.

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

 

Article ID: Published Date: Last Revised Date: Platform: Control:
2769 11/21/2014 11/25/2014 Silverlight OlapClient
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon