Select to view content in your preferred language

how to get  the attributes of a node in a FeatureLayer's cluster?

1202
2
12-27-2010 03:38 PM
LianchengRen
Emerging Contributor
A featurelayer has Cluster.
        private void FeatureLayer_Initialized(object sender, EventArgs e)
        {
            ((FeatureLayer)sender).MouseRightButtonDown += new FeatureLayer.MouseButtonEventHandler(FeatureLayer_MouseRightButtonDown);
        }

        private void FeatureLayer_MouseRightButtonDown(object sender, GraphicMouseButtonEventArgs args)
        {
            args.Handled = true;
            string key = (string)args.Graphic.Attributes["JH"];
        }


(string)args.Graphic.Attributes["JH"]: I cannot get the attribute if the clicking graphic is a node of a cluster.

Thanks.
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
This is related thread: http://forums.arcgis.com/threads/18534-FlareClusterer-event-bug Kindly look at post #2. What is returned by FindGraphicsInHostCoordinates() is an IEnumerable<Graphic>, which are the individual nodes contained in the cluster. You can iterate through these nodes and get their attributes.
0 Kudos
LianchengRen
Emerging Contributor
I tried FindGraphicsInHostCoordinates(), but it cannot know which node is clicked.
I make a temporary solution�?set a Maptip and use MapTip.DataContext as IDictionary<string, object> to get the correct attributes now.


This is related thread: http://forums.arcgis.com/threads/18534-FlareClusterer-event-bug Kindly look at post #2. What is returned by FindGraphicsInHostCoordinates() is an IEnumerable<Graphic>, which are the individual nodes contained in the cluster. You can iterate through these nodes and get their attributes.
0 Kudos