c# - How to cope with bidimensional data display AND edit -


i have display double x,y offset in datagrid. in mind (done excel , photoshop):

enter image description here

allowing users change offset value. having numbers printed on rows , columns.

at moment offset structure is:

 public point[,] pointmatrix; 

but when associate datagrid error:

enter image description here

so perhaps bidimensional array not right type. hint how it?

unfortunately can't set itemsource of datagrid 2d array, need either bind list<list<point>> of datatable, using datatable easier since won't require changes, add following converter method convert 2d array datatable:

 private dataview convertfrommatrixtodatatable(point[,] matrix)     {          var mydatatable = new datatable();                     (int = 0; < matrix.getlength(0); i++)         {             mydatatable.columns.add(i.tostring());         }          (int j = 0; j < matrix.getlength(1); j++)         {                             var row = mydatatable.newrow();              (int = 0; < matrix.getlength(0); i++)             {                 row[i] = matrix[i, j];             }              mydatatable.rows.add(row);         }          return mydatatable.defaultview;     } 

then use affect datagrid's itemsource :

dtgnests.itemssource = convertfrommatrixtodatatable(pointmatrix); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -