Chart for WPF and Silverlight / Chart Features / Style and Appearance / Chart Styles / Mouse Over Style
In This Topic
Mouse Over Style
In This Topic

The following example shows how to create a style that sets the Stroke property for a PlotElement to Black:

XAML
Copy Code
<Window.Resources>
   ...
   <Style x:Key="mouseOver" TargetType="{x:Type c1c:PlotElement}">
          <!-- Default black outline -->         
          <Setter Property="Stroke" Value="Black" />
          <Style.Triggers>
          <!-- When mouse is over the element make thick red outline  -->
                 <Trigger Property="IsMouseOver" Value="true">
                        <Setter Property="Stroke" Value="Red" />
                        <Setter Property="StrokeThickness" Value="3" />
                        <Setter Property="Canvas.ZIndex" Value="1" />”
                 </Trigger>
          </Style.Triggers>
   </Style>
</Window.Resources>
Note: When you set the TargetType of your style to the PlotElement type without assigning the style with an x:Key, the style gets applied to both of your PlotElement elements.

To apply the mouseover styles to the data series you can use set the SymbolStyle property like the following:

XAML
Copy Code
<c1c:DataSeries … SymbolStyle="{StaticResource mouseOver}"/>

 

See Also