Using a StackColumn a want to show a tooltip with the above elements: The legend, the label and the X and YData. . Everytging is working except the label. My data template is the above:
DataTemplate template = new DataTemplate();
FrameworkElementFactory border = new FrameworkElementFactory(typeof(Border));
border.SetValue(Border.BackgroundProperty, Brushes.WhiteSmoke);
border.SetValue(Border.CornerRadiusProperty, new CornerRadius(5, 5, 5, 5));
border.SetValue(Border.PaddingProperty, new Thickness(3.0));
border.SetValue(Border.BorderBrushProperty, Brushes.LightGray);
border.SetValue(Border.BorderThicknessProperty, new Thickness(2.0));
FrameworkElementFactory stackpanelVertical = new FrameworkElementFactory(typeof(StackPanel));
stackpanelVertical.SetValue(StackPanel.OrientationProperty, Orientation.Vertical);
FrameworkElementFactory stackpanelLegend = new FrameworkElementFactory(typeof(StackPanel));
stackpanelLegend.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
FrameworkElementFactory chartLegend = new FrameworkElementFactory(typeof(Syncfusion.UI.Xaml.Charts.ChartLegend));
chartLegend.SetValue(Syncfusion.UI.Xaml.Charts.ChartLegend.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
chartLegend.SetValue(Syncfusion.UI.Xaml.Charts.ChartLegend.VerticalAlignmentProperty, VerticalAlignment.Center);
chartLegend.SetValue(Syncfusion.UI.Xaml.Charts.ChartLegend.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch);
chartLegend.SetValue(Syncfusion.UI.Xaml.Charts.ChartLegend.VerticalContentAlignmentProperty, VerticalAlignment.Center);
Binding chartLegendBinding = new Binding();
chartLegendBinding.Path = new PropertyPath("Interior");
chartLegend.SetValue(Syncfusion.UI.Xaml.Charts.ChartLegend.BackgroundProperty, chartLegendBinding);
FrameworkElementFactory txtblockLabel = new FrameworkElementFactory(typeof(TextBlock));
txtblockLabel.SetValue(TextBlock.FontSizeProperty, 12.0);
txtblockLabel.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
txtblockLabel.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
txtblockLabel.SetValue(TextBlock.ForegroundProperty, Brushes.Black);
Binding label = new Binding();
label.Path = new PropertyPath("Label");
label.Converter = new LegendValueConverter();
txtblockLabel.SetValue(TextBlock.TextProperty, label);
FrameworkElementFactory stackpanelValues = new FrameworkElementFactory(typeof(StackPanel));
stackpanelValues.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
FrameworkElementFactory txtblockX = new FrameworkElementFactory(typeof(TextBlock));
txtblockX.SetValue(TextBlock.FontSizeProperty, 12.0);
txtblockX.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
txtblockX.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
txtblockX.SetValue(TextBlock.ForegroundProperty, Brushes.Black);
Binding XDataBinding = new Binding();
XDataBinding.Path = new PropertyPath("Item");
XDataBinding.Converter = new ValueConverter();
txtblockX.SetValue(TextBlock.TextProperty, XDataBinding);
FrameworkElementFactory txtblockSeperator = new FrameworkElementFactory(typeof(TextBlock));
txtblockSeperator.SetValue(TextBlock.FontSizeProperty, 12.0);
txtblockSeperator.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
txtblockSeperator.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
txtblockSeperator.SetValue(TextBlock.ForegroundProperty, Brushes.Black);
txtblockSeperator.SetValue(TextBlock.TextProperty, ":");
FrameworkElementFactory txtblockY = new FrameworkElementFactory(typeof(TextBlock));
txtblockY.SetValue(TextBlock.FontSizeProperty, 12.0);
txtblockY.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
txtblockY.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
txtblockY.SetValue(TextBlock.ForegroundProperty, Brushes.Black);
Binding YDataBinding = new Binding();
YDataBinding.Path = new PropertyPath("YData");
YDataBinding.StringFormat = NumberFormat;
txtblockY.SetValue(TextBlock.TextProperty, YDataBinding);
stackpanelLegend.AppendChild(chartLegend);
stackpanelLegend.AppendChild(txtblockLabel);
stackpanelValues.AppendChild(txtblockX);
stackpanelValues.AppendChild(txtblockSeperator);
stackpanelValues.AppendChild(txtblockY);
stackpanelVertical.AppendChild(stackpanelLegend);
stackpanelVertical.AppendChild(stackpanelValues);
border.AppendChild(stackpanelVertical);
template.VisualTree = border;
return template;
Any help?
Thanks
George