/// <summary>
        /// Event handler for changing selected tab in tabstrip (metrics)
        /// </summary>
        void MetricChanged(object sender, RoutedEventArgs e)
        {
            if (this.currentTabItem != null)
            {
                this.currentTabItem.Content = null;
            }

            if (this.TabStrip.SelectedItem != null)
            {
                TabItem tabItem = (TabItem)this.TabStrip.SelectedItem;
                TextBlock textBlock = (TextBlock)tabItem.Header;
                string metricName = textBlock.Text;
                Chart chart;

                // Find the corresponding chart to be displayed
                if (this.currentDatasetMetricCharts != null &&
                    this.currentDatasetMetricCharts.TryGetValue(metricName, out chart))
                {
                    xamlTextCanvas.Children.RemoveRange(1, xamlTextCanvas.Children.Count - 1);
                    xamlChartCanvas.Children.Clear();
                    xamlLegendCanvas.Children.Clear();

                    this.currentTabItem = tabItem;
                    this.currentChart = chart;
                    tabItem.Content = xamlPanel;

                    chart.Draw(xamlTextCanvas, xamlChartCanvas, xamlLegendCanvas);
                }

                this.currentTabItem = tabItem;
            }
        }
        /// <summary>
        /// Display the tabs and charts for the selected dataset
        /// </summary>
        private void GenerateTabs()
        {
            // Removing parent-children relationship with old tabs
            foreach (TabItem item in TabStrip.Items)
            {
                item.Content = null;
            }
            this.TabStrip.Items.Clear();

            // Creating new tabs with tooltips
            bool firstChart = true;
            foreach (Chart c in this.currentDatasetMetricCharts.Values)
            {
                TabItem item = new TabItem();

                TextBlock titleBlock = new TextBlock();
                titleBlock.Text = c.Title;

                TextBlock tooltipBlock = new TextBlock();
                tooltipBlock.TextWrapping = TextWrapping.Wrap;
                tooltipBlock.Width = 300.0d;
                tooltipBlock.Text = c.Description;

                ToolTip toolTip = new ToolTip();
                toolTip.Content = tooltipBlock;

                titleBlock.ToolTip = toolTip;
                item.Header = titleBlock;

                if (firstChart)
                {
                    this.currentTabItem = item;
                    this.currentChart = c;
                    item.Content = xamlPanel;
                    firstChart = false;
                }

                this.TabStrip.Items.Add(item);
            }

            this.TabStrip.SelectedIndex = 0;
        }