Select to view content in your preferred language

view details on dataform or datagrid panning level

1499
6
01-30-2012 12:10 PM
ForamParikh
Regular Contributor
I want to implement dataform or datagrid items should updated on base of view of map.it means if i have 20 features are available on my graphical layer.but on my screen i can see 10 features and another 10 features are available but i can visible them if i do panning or zoomin or zoom out.so i want on datagrid or dataform only 10 features details should visible and i do zoom in or panning it should updated if now i can see only 2 features then it should display only 2 features details on data grid or dataform.is there any way if i use envelop or something?

and also i am using two different tables one is spacial table and another is project details and they are related with one to many relationship so i don't have single table with all details

I think it is very difficult but i will appritiate if any one has solution.

Thanks
Foram
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
I want to implement dataform or datagrid items should updated on base of view of map.it means if i have 20 features are available on my graphical layer.but on my screen i can see 10 features and another 10 features are available but i can visible them if i do panning or zoomin or zoom out.so i want on datagrid or dataform only 10 features details should visible and i do zoom in or panning it should updated if now i can see only 2 features then it should display only 2 features details on data grid or dataform.is there any way if i use envelop or something?

and also i am using two different tables one is spacial table and another is project details and they are related with one to many relationship so i don't have single table with all details

I think it is very difficult but i will appritiate if any one has solution.

Thanks
Foram


You have to use the 'FilterSource' proeprty of the FeatureDataGrid.
On Map event 'ExtentChanged', you can create  a list with all graphics in the current extent and set FilterSource to that list.
0 Kudos
ForamParikh
Regular Contributor
Thanks i think this is good idea.but how can i find the list of graphics within extend?I tried
List<Graphic> graphicsList = new List<Graphic>();
            GraphicsLayer f;
            foreach (Graphic gg in MyMap.Extent)
            {
               
            }

but it gives me error also let me know how to find multiple graphics with in graphical layer.I want to add selection in this selection user can draw polygon on graphical layer so it should select only those graphics with in that polygon and also it should bind feature grid with selected graphics information.so i think i have to write some code i can't use editor.

Please help,
Thanks
Foram
0 Kudos
ForamParikh
Regular Contributor
Also i tried

List<Graphic> graphicsList = new List<Graphic>();
            GraphicsLayer gl = MyMap.Layers["glayer"] as GraphicsLayer;
            foreach (Graphic gg in gl.Graphics)
            {
                if (gg.Geometry.Extent.Intersects(MyMap.Extent) == true)
                {
                    graphicsList.Add(gg);
                }
            }

but always it shows me all graphics.

Please help
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Your second version should be OK (if you initialize the FilterSource)

I just tested with the FeaturedataGrid interactive sample by hooking up this handler to Map ExtentChanged event:

private void MyMap_ExtentChanged(object sender, ExtentEventArgs e)
{
    var dataGrid = MyDataGrid;
    var map = sender as ESRI.ArcGIS.Client.Map;
    dataGrid.FilterSource = dataGrid.GraphicsLayer.Graphics.Where(g => g.Geometry.Extent.Intersects(map.Extent));
}



Looks working.
0 Kudos
ForamParikh
Regular Contributor
Thanks but I am using datagrid not featured data grid.So how can i do filter?
i tried

QueryDetailsDataGrid.ItemsSource = featureSet.Features.Where(g11 => g11.Geometry.Extent.Intersects(MyMap.Extent)); but I am getting error.

or can i change style of featuredatagrid as datagrid also i don' t want any paging or dropdownlist in datagrid it should simple[ATTACH=CONFIG]11611[/ATTACH]

so can i make featuredatagird like this example?

Please help,

Thanks
0 Kudos
JenniferNery
Esri Regular Contributor
If you want filter applied on FeatureDataGrid, you need to set its FilterSource property as Dominique suggested. I think you just need to add .ToList().

dataGrid.FilterSource = dataGrid.GraphicsLayer.Graphics.Where(g => g.Geometry.Extent.Intersects(map.Extent)).ToList();
0 Kudos