Hello,
I'm using a XamDataChart with some ScatterLineSeries and would like to allow the user to click on a marker on the serie to do some action based on the data value of that point.
My question is, how can get the data on the point by clicking on the marker ?
Thank you for the help.
Hello Oussema,
Thank you for your post. I have been looking into the question that you are having and you can use The XamDataChart’s SeriesMouseLeftButtonDown event. In the event arguments of this event, there is an Item property, which returns the clicked item, if you click on a point in the series. I have created a sample application for you, that shows how you can get the clicked point, using this approach.
Please let me know if I can assist you with anything else.
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Thank you Krasimir for the response.
That should sove part of the problem. Actually, I implemented a template for the serie marker so that I can change the marker color when I click on it (I believe it's not possible with the approach you provided).
My approch is good, and it's working, only I can use it with XAML code. The thing is, I'm building my XamDataChart dynamically, so I need to assign the template I created by the C# code instead.
Do you have any idea on how I can do that.
I've been trying to do it this way:
MarkerEditor me = new MarkerEditor(); //MarkerEditor is my Template for the markersme.TargetPropertyName = "ValNum"; //The YMemberPath in my ScatterLineSeriesme.Width = 20; me.Height = 60;me.Style = (Style)this.Resources[0]; //a style declared in the <UserControl.Resources> of the XAML file
then I do something like : MySerie.MarkerTemplate = new DataTemplate(me.GetType());
Thanks again for the help.
Thank you for your reply. I have been reading through it and if you wish to create a DataTemplate in code, you need to use FrameworkElementFactory object and set the DataTempalte’s VisualTree to that factory object. I have modified the sample that I have sent with my previous post, to create the XamDataChart and the MarkerTemplate in code.
Hello Krasimir,
Allow me to return on this case and ask for more support.
I've been using your solution and it's working amazingly. The thing is, my needs are getting bigger and know I'm trying to change each marker color according to a property in my data model. Example: My Data model has a boolean property named "AlertOn", if it's "true", my marker has to be blue.
I tried a couple of things but that doesn't seem to work, so if you have any idea please share it with me.
Thank you very much.
And happy new year.
Best Regards.
Oussema Slaimi.