changing item source / binding of feature data grid

416
1
01-11-2012 11:37 AM
DaveOrlando
Occasional Contributor III
Hello,

I have a featuredatagrid that I bind to a featurelayer, no problem. I have added some functionality for the user to query more detailed info in our database, based on the features in the featurelayer. I change the featuredatagrid to view this new data, but my toggle to 'rebind' back to the featurelayer does not update the featuredatagrid until a new selection has been made.

Is there a way force the grid show the rebound data.

I also notice that in most examples, to bind to a featurelayer the dependencyproperty is graphiclayerproperty, while when switching to my new class we use dp = itemsourceproperty. i would think these should be the same?

if (rb.Name.ToLower().Contains("raw"))
            {
                Binding b = new Binding();
                b.Source = Join_LegalAndOwners;
                BindingOperations.SetBinding(FGrid, FeatureDataGrid.ItemsSourceProperty, b);
            }
            else
            {
                Binding b = new Binding("Layers.[FLParcels]");
                b.Source = MyMap;
                BindingOperations.SetBinding(FGrid, FeatureDataGrid.GraphicsLayerProperty, b);


alternatively, is there a way to temporarily append some new columns to either the featurelayer itself, or to the featuredatagrid. i think not because it is tied so tight to the featurelayer

thanks for any pointers
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You should be setting FeatureDataGrid.GraphicsLayer property, not its ItemsSource. You can probably use another GraphicsLayer to display the results from your database.

You are right that FeatureDataGrid.Headers are dependent on FeatureLayer.Fields. However if you are using GraphicsLayer, the columns/headers will be dependent on graphic.Attributes. So if you find that using FeatureLayer is limiting, you can switch to using GraphicsLayer so you can add/remove to the graphic.Attributes and have FeatureDataGrid reflect this change.
0 Kudos