Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hi Currently i'm using this to turn it into a data table

 featureCursor = layer.FeatureClass.Search(que, false);
                    row = featureCursor.NextFeature();

                    if (row != null)
                    {
                        for (int i = 0; i < row.Fields.FieldCount; i++)
                        {
                            dataTable.Columns.Add(row.Fields.get_Field(i).Name);
                        }
                        while (row != null)
                        {
                            dataRow = dataTable.NewRow();

                            for (int j = 0; j < featureCursor.Fields.FieldCount; j++)
                                dataRow[j] = row.get_Value(j);

                            dataTable.Rows.Add(dataRow);
                            row = featureCursor.NextFeature();
                        }
                    }

Does anyone know a more efficient way on doing this.

Also I'm binding the data table to a datagrid, does anyone know a good way i can do this so that i can make the attribute table editable, and values reflected in the feature layer.

I can do this, but not cleanly, has anyone tried this before?

Thanks and Regards, Kev84

share|improve this question
    
Since you are using wpf, are you wanting to leverage INotifyPropertyChanged for the binding? –  Kirk Kuykendall Aug 10 '11 at 20:52

1 Answer 1

up vote 2 down vote accepted

There is a binding sample from ESRI.

Check it out:

http://edndoc.esri.com/arcobjects/9.2/NET/a6eb84fb-93db-4bc3-82a9-874d8890a8ca.htm

Same sample in ArcGIS 10 documentation

share|improve this answer
    
Tested this a while back and it worked, I think I also added a wrapper for the IRow to hide the ArcObjects interface from the .net code but that depends on what requirements you have. –  MathiasWestin Aug 12 '11 at 7:36
    
how we could add Sort functionality to this wrapper ? –  geogeek Jul 21 '12 at 12:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.