Hi,
I have a binding for CursorPosition in CrosshairLayer:
<Setter Property="CursorPosition" Value="{Binding DataCursorPosition, Mode=OneWay}" /> If I change the zoom it is placed not over data point, if not zoomed works fine.updating cursor cursor in ViewModel:
DataCursorPosition = (double)(dataPoint.Time.Ticks - minTime.Ticks) / (maxTime.Ticks - minTime.Ticks);
Best regards,Krzysztof
Hello Krzysztof,
I have been investigating into the behavior you are seeing, but I cannot seem to reproduce the behavior where zooming does not place the CrosshairLayer on the data point. One thing that may be a problem with the code you are using in this case though, is that the CursorPosition property take a Point object – not a double, and so I’m not sure that your binding to DataCursorPosition will work in this case unless you are converting it somehow?
I am attaching the sample project I used to test this. In the sample, the crosshair stays locked to the data point I have defined and am calculating the position of.
Please let me know if you have any other questions or concerns on this matter.
XamDataChartCrosshairPositionBinding.zip
Hi Andrew,
yes, sorry, I was too quick and 'shorten' too much the code and in fact there is DataCursorPosition = new Point(<calculated position>, 1)but I went through the properties of xamDataChart and at the end looks like it is caused by PlotAreaMargin ...
We have set it to 20I'm trying to figure out how to adjust position with WindowRect and this marginBest regards,Krzysztof