Hi ,
i want to create a line chart , where i can drag the line using the mouse and modify the graph doing so.
i am using MVVM , so i would like each mouse drag to change my VM data. so i can use it later .
is this supported by XamDatachart ?
if so, can i get a small example or a link ?
Thanks.
Hi Shaul,
You can use a behavior to attach to the line series and in the behavior handle the mouse events required for manipulating the data. In the behavior I detect which item in the line series was clicked and while the user is holding the left mouse button down they can drag the data point up or down to give it a new value.
Take a look at the attached sample and let me know if it helps.
Hi Rob,
Can you give an updated Version of this sample Project wich is compatible with Ultimate for WPF 2018.2?
Hi Horst,
Here's an updated version using the 18.2 dlls. It uses nuget to get them.
7522.xamDataChart-DragLineSeriesData-18.2.zip
Sorry for the late reply, but I had to follow up other things in our company....I tried the updated Version and I still get Errors:In MainWindow.xaml at line 24 Position 22 I get an error:
The Tag "Interaction.Behaviors" is not contained in XML-Namespace "http://schemas.microsoft.com/expression/2010/interactivity"
Regards Horst
That's probably because you don't have the Expression Blend SDK installed which is fine, there is a Nuget package for it now. I updated the sample to use this package so it should work for you now.
4503.xamDataChart-DragLineSeriesData-18.2.zip
Hi Rob,I have Expression Blend SDK already installed. There must be something else.
FYI: My develepment machine has restricted Access to the net. Thus connecting to Nuget Feeds is currently forbidden. Thus I had to replace the .dll links to the places of my local Installation.
The links all are OK.
might be related to -> stackoverflow
regards Horst
I'm not really sure what the issue could be then if you have all the assemblies required. That stackoverflow issue deals more with using Interaction.Behavior inside a Resource tag which this sample does not do.
I can also see in your screenshot that there are more errors for other objects as well. Have you tried to build the project regardless of those errors? In some cases the XAML designer is known to display errors but the project is still capable of building and running successfully.
You could also try some of the solutions listed here: https://stackoverflow.com/questions/14665713/the-name-does-not-exist-in-the-namespace-error-in-xaml
But if you can still build and run the project regardless of those designer errors then I wouldn't worry about it too much for this sample. The designer isn't useful in this scenario. The important parts are in the behavior itself at how it attaches to the chart series.
thank you for the hints.
The Problem was that your sample Project was built against .NET Framework Version 4.0 while the Interaction assembly was built agains Version 4.5.
Setting the target Framework of the sample Project to 4.61 solved the Problem.
It is an old sample so I'm not surprised it targets 4.0 but I should have realized what versions of .NET everything was targeting. I'll keep that in mind the next time I need to update older samples. I'm glad you were able to figure it out and resolve it though. Awesome!
thank you for the stackoverflow link. The last entry let me to the solution...
scolling down the list showed an entry that System.Windows,Interactivity was built against .NET 4.5.
The sample Project was built against 4.0 Client. Thus selecting 4.61 as target Framework and rebuilt, solved the Problem.