I want to have a mouse over effect when the mose passes a marker of a ScatterSeries preferrable by Code similar as the xamDataChart "Series Highlighting on Legend Hover" example in the WPF Samples Browser.
Regards Horst
Hello Teodosia,
Thank you for the example. I should have been more verbose explaining what I wanted to acheeve…
I wanted the mouse over effect on a single maker the mouse is over. The sample supplied sets the effect to all the markers.
How can the effect be only applied to the marker under the mouse cursor?
Hello Horst,
I have been looking into your question and after research I determined two things:
1. Thickness property is not available for Markers. This means that only the “Opacity” can be changed.2. To access the markers of the series and apply custom animation, you have to get all series markers and loop through the entire collection in order to define the one, which IsMouseOver property is set to true. It will happen every time when the mouse hover or leave a marker so it will invoke a huge amount of iterations and will cost an issues with the performance and even possible unexpected behavior.
A better and more performant way for achieving your requirement is to use style trigger for the Marker. In this style, after checking if IsMouseOver property is true, the Opacity could be set to the desired value.
<Style x:Key="test" TargetType="{x:Type ig:Marker}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Opacity" Value="0.5"/> </Trigger> </Style.Triggers> </Style>
I modified the previously attached sample according to this suggestion. I am keeping the animation for hovering the item through the legend.
Please test it on your side and let me know if I may be of any further assistance.
Sincerely, Teodosia Hristodorova Associate Software Developer
8508.Scatter_Series.zip
you sample works only for a BubbleSeries. Altering the series type to ScatterSeries will not Show any MouseOver effect.
<ig:XamDataChart.Series> <ig:ScatterSeries ItemsSource="{StaticResource data}" MarkerStyle="{StaticResource test}" XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}" XMemberPath="X" YMemberPath="Y" Title="Bubble Series I" Legend="{Binding ElementName=Legend}" IsHighlightingEnabled="False" > </ig:ScatterSeries> </ig:XamDataChart.Series>
<Style x:Key="myStyle" TargetType="{x:Type ig:Marker}" > <EventSetter Event="MouseEnter" Handler="Marker_MouseEnter"></EventSetter> <EventSetter Event="MouseLeave" Handler="Marker_MouseLeave"></EventSetter> </Style>
private void Marker_MouseEnter(object sender, MouseEventArgs e) { (sender as Marker).Opacity = 0.5; } private void Marker_MouseLeave(object sender, MouseEventArgs e) { (sender as Marker).Opacity = 1; }
thank you for the update. It works as expected.
I think the previous Approach did not work with Scatterline because the Style assigned to the marker defined in "generic.shared.xaml" is already defing a VisualStateManager using "MouseOver"
I am glad that you managed to achieve your requirement using my approach.
Thank you for using Infragistics components.
Sincerely,Teodosia HristodorovaAssociate Software Developer
thank you for the update. I do not see any reason why this property should be set local. Your developer Team might rethink this Setting.
Anyway it works with your Approach...
Thank you for your help.