int selectedCount; // Variable to keep track of the selection count in FeatureLayer public YourUserControlClassConstructor() { InitializeComponent(); FeatureLayer featureLayer = MyMap.Layers["MyFeatureLayer"] asFeatureLayer; featureLayer.Graphics.CollectionChanged += Graphics_CollectionChanged; selectedCount = featureLayer.SelectionCount; } privatevoid Graphics_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (selectedCount == 0 /* No selections before */ && MyDataGrid.SelectedItems.Count == 1 /* Unwanted selection after the change in graphics collection */) MyDataGrid.SelectedItems.Clear(); selectedCount = MyDataGrid.SelectedItems.Count; }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.