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; }
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.