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; }
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.