Hi,
In the tooltip of an XamDataChart it always shows a small icon of whether the chat is a line series or a bar series or a column series. How can i remove that and customize it how i wish to.
Thanks,
Nazha
Its best not to try to access the controls of the tooltip and make changes to them. Instead, its better to bind from the tooltip against information that will change the appearance of the tooltip depending on context.
If you look at the default style of the tooltip you will notice how it refers to things such as Series.ActualMarkerTemplate and Series.ActualMarkerBrush, so that the series that is in context can provide these values for rendering in the tooltip. You can also reference values on the relevant data item through the Item property in the bindings.
So, if you want to change the way the tooltip behaves, by far the easiest way is to make the information available on the data item being hovered or the series being hovered.
When making information available on the data item, you can just add properties. When making information available on a series, you will have to use attached properties.
Does this help?
-Graham
What i mean is that i put the above Style in my UserControl.Resources and then assigned this Style to the ToolTipStyle of my XamDataChart. So now when i hover over a stackedfragment of my stacked column chart i get a tooltip that has a rectangle and traingle and text in it just like the style.
what i want is at run time to access this rectangle of the tooltip and change its fill color. and also to access the text block and change its text. I could only access the control template and from there i could not access the stack panel under it and consequently the rectangle and text block.
how can i do that?
Many Thanks,
Could you elaborate as to what you mean?
There is a DataContext (class in the chart library) that is assigned as the DataContext for the tooltip. So you can bind against properties such as Series.ActualMarkerBrush etc from your tooltip template. Peruse the default styles applied to the chart for more detail.
Thanks it worked. However i want to access the TextBlock and the Fill property of the Rectangle in my back code because the data is dynamic. How can i do that?
<Style x:Key="ToolTipStyle" TargetType="ContentControl">
<Setter x:Name="settertooltip" Property="Template">
<Setter.Value>
<ControlTemplate x:Name="controlt" TargetType="ContentControl">
<StackPanel x:Name="teststack" HorizontalAlignment="Left" Height="28" Margin="0" VerticalAlignment="Top" Width="23">
<Rectangle HorizontalAlignment="Left" Height="21" Width="23" Fill="#FF005E97" VerticalAlignment="Top"/>
<ed:RegularPolygon Fill="#FF005E97" InnerRadius="1" PointCount="3" Stretch="Fill" UseLayoutRounding="False" RenderTransformOrigin="0.51,0.54" Height="7" VerticalAlignment="Top" Margin="4,-1,4,0" Width="15">
<ed:RegularPolygon.RenderTransform>
<CompositeTransform Rotation="180"/>
</ed:RegularPolygon.RenderTransform>
</ed:RegularPolygon>
<TextBlock x:Name="testtext" Height="10" Width="23" Margin="0,-22,0,0" TextWrapping="Wrap" LineHeight="8" TextAlignment="Center" FontSize="8" FontFamily="Verdana" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="White"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
See: https://es.infragistics.com/community/forums/f/retired-products-and-controls/60977/tooltip-background/310047#310047