How to I implement dragging up or down a bar or line on the WPF chart?
You can try testing the attached project. It represents a quite simple example of dragging up or down columns of the chart.
Teodor,
I assume there is a way to do two-way binding with this otherwise there would be no point in allowing usrs to change the values. I've merged your sample code with Grahams from http://community.infragistics.com/forums/p/38169/219968.aspx I'm using MVVM. My ultimate goal is to bind the XamChart changes to the ActiveRecord in a XamDataGrid.
I assume there is a way to specify a two-way binding between the XamChart data point value that is being changed and the backing class? Can you point me in a direction?
Thx,
Ivan
I added this code to my mouse button up event handler. It works, but it is kind of smelly to me. Two-Way binding would be much clearner.
var fieldInfo = typeof (DataPoint).GetField("_oldBindingObject", BindingFlags.NonPublic | BindingFlags.Instance);if ( fieldInfo != null ){ var dataItem = (TestDataItem) fieldInfo.GetValue(selectedDataPoint); dataItem.Value = selectedDataPoint.Value; selectedDataPoint.ToolTip = dataItem.Tooltip;}
Or this...
if ( selectedDataPoint == null ) return;var index = ( (Series) selectedDataPoint.Parent ).DataPoints.IndexOf(selectedDataPoint);var dataItem = ( (IEnumerable<TestDataItem>) ( (Series) selectedDataPoint.Parent ).DataSource ).ElementAt(index);
Currently, this is not possible. You need to change the value of the data source.
So... A two-way binding defined within the XAML is not possible? Only code-behind/attached properties will allow me to update the active record in my xamdatagrid. True/False?
Thx
You can use:
TestDataItem dataItem = this.selectedDataPoint.DataContext as TestDataItem;