Wonder if somebody could help me.
How can I create a simplest TwoWay
edited table that display an double array ?
For example double arr[] = new double [] {90,60,45,30,10,1,0.8}
Then I create DataGrid
in XAML. How to bind every array element to appropriate gridRow. Or maybe easiest way to make it with any other WPF control that allows to calculate items for their indexes
Will be grateful to hear any of your answers.
Try to explain my problem from other side. I have an array
double[] degree = { 90, 60, 45, 30, 10, 1, 0.8, 0.6, 0.4, 0.2, 0, 0.2, 0.4, 0.6, 0.8, 1, 10, 30, 45, 60, 90 };
In winforms I fill table rows with it.
InitializeComponent();
dataGridView1.Rows.Add(21);
for (int i = 0; i < 21; i++)
dataGridView1.Rows[i].Cells[0].Value = degree [i]`
Like shown in the picture above. Now I am looking for simplest and useful way with WPF.
using System.Windows.Data; // for table
public MainWindow()
{
InitializeComponent();
DataTable dt= new DataTable();
dt.Columns.Add("Header name");
for (int i = 0; i < degree.Length; i++)
dt.Rows.Add(degree[i]);
DG.ItemsSource = dt.DefaultView; // DG - name of DataGrid in which DataTable.
}
This way table look like in the picture. But I can't get values from cells of "DataTable" use indexes (like "dataGridView1.Rows[i].Cells[0].Value") for further calculations or pass values of cells to another array. Someone offer to use collection of objects, but I don't find a way to create collection with array as property. Could someone offer a simple and applicable way to solve my problem.