Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Chart Marker Precedence
posted

Hi

I have a chart that has a series which plots one or more custom markers. The user can select one of the markers to highlight and the intention is that the border thickness of the marker gets thicker when selected and that the marker jumps in front of other markers.

At present when I select the marker the thickness increases but the marker does not jump to the front.

   

(Here the red item is selected but remains behind the purple marker)

I have a template for the marker as follows:

<DataTemplate x:Key="CustomMarkerTemplate">
<Ellipse Cursor="Hand"
Fill="{Binding Item.SpectrumBrush}"
PreviewMouseDown="Ellipse_PreviewMouseDown"
Stroke="Black"
ToolTipService.ShowDuration="9999999">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="StrokeThickness"
Value="2" />
<Setter Property="Width"
Value="15" />
<Setter Property="Height"
Value="15" />
<Setter Property="Panel.ZIndex"
Value="0" />
<Style.Triggers>
<DataTrigger Binding="{Binding Item.IsVisible}"
Value="False">
<Setter Property="Visibility"
Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Item.DataPoints}"
Value="{x:Null}">
<Setter Property="Visibility"
Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Item.IsSelected}"
Value="True">
<Setter Property="StrokeThickness"
Value="3" />
<Setter Property="Width"
Value="20" />
<Setter Property="Height"
Value="20" />
<Setter Property="Panel.ZIndex"
Value="1" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</DataTemplate>

Note that the marker is bound to an "Item.IsSelected" property that sets the Panel.ZIndex property, however this does not appear to work.

Any Ideas?

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Steven,

    Thank you for your post on this matter.

    Before we get started, I would just like to confirm if this is actually a UWP question or if you had meant to post it in the WPF forums? I ask, as there is a tag for XamDataChart in the tags of this forum, so perhaps this was posted in the wrong area? I can move it if so.

    Please let me know if you have any other questions or concerns on this matter.

Children
No Data