I have a data template for a tooltip. Inside the data template, I have a border with rounded corners and shadow effect. I want the surround area to be transparent, but somehow the date template background is black. How can I change this to transparent?
Attached is a screen capture of what the tool tip looks like with the black background.
Here's the code for the data template:
<DataTemplate x:Key="tooltipTemplate"> <Grid Background="Transparent"> <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="5" Background="White" IsHitTestVisible="False" Padding="5" Margin="10"> <ItemsControl ItemsSource="{Binding}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Visibility="{Binding Series.Visibility}" > <TextBlock Name="title" Text="{Binding Series.Title}" /> <TextBlock Text=": " /> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Item.Value}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text=" Sample Time: " /> <TextBlock Text="{Binding Item.Key}" /> </StackPanel> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Border></Grid> </DataTemplate>
Your sample works fine, but the we are using a datatemplate for the tooltip. When I apply your style, the tooltip comes up black with no data inside it.
Here is how the data template is being called:
<classes:ChartBehaviors.CursorTooltip> <classes:CursorTooltipBehavior tooltipTemplate="{StaticResource tooltipTemplate}"/> </classes:ChartBehaviors.CursorTooltip>
If I either leave in or take out the tooltipTemplate resource and just use the ToolTip style inside the xamdatachart tag, then the tooltip comes up black.
Here is the code for the data template:
Is there anyway to work directly in the datatemplate? I don't understand why setting the grid background to transparent in the datatemplate doesn't work the same way it does in the style.
Any ideas???
Hello,
I am just checking if you require any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thank you for your post. I have been looking into the appearance that you are trying to achieve and I have created a sample application for you that demonstrates how you can achieve it, by creating a style for ContentControl and assign it to the ToolTipStyle property of the XamDataChart.
If you need any further assistance please do not hesitate to ask.