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
15
CrosshairLayer does not show
posted

Hi,

I want to do some customization on the crosshair, the basic would be to only show the vertical line. But the crosshair layer does not show.

If I have an example code like this:

XAML:

<ig:XamDataChart x:Name="Chart"
                         CrosshairVisibility="Visible">
            <ig:XamDataChart.Axes>
                <ig:NumericXAxis x:Name="XAxis" />
                <ig:NumericYAxis x:Name="YAxis" />
            </ig:XamDataChart.Axes>
            <ig:XamDataChart.Series>
                <ig:ScatterSeries x:Name="Series1" 
                                  XMemberPath="X" 
                                  YMemberPath="Y" 
                                  XAxis="{Binding ElementName=XAxis}" 
                                  YAxis="{Binding ElementName=YAxis}" />
            </ig:XamDataChart.Series>
</ig:XamDataChart>

Code behind:

public MainWindow()
        {
            InitializeComponent();
            this.Series1.ItemsSource = new Point[] { new Point(0, 0), new Point(5, 5) };
        }

Then the crosshair layer will show as expected (without any customization):

But if I modify the XAML to have the crosshair layer:

<ig:XamDataChart x:Name="Chart">
            <ig:XamDataChart.Axes>
                <ig:NumericXAxis x:Name="XAxis" />
                <ig:NumericYAxis x:Name="YAxis" />
            </ig:XamDataChart.Axes>
            <ig:XamDataChart.Series>
                <ig:ScatterSeries x:Name="Series1" 
                                  XMemberPath="X" 
                                  YMemberPath="Y" 
                                  XAxis="{Binding ElementName=XAxis}" 
                                  YAxis="{Binding ElementName=YAxis}" />
                <ig:CrosshairLayer VerticalLineVisibility="Visible"
                                   HorizontalLineVisibility="Collapsed" />
            </ig:XamDataChart.Series>
</ig:XamDataChart>

The crosshair will not show:

How can I make the CrosshairLayer show, so I can add the customizations to it?

Thank you for helping