private void ItemClose(object sender) { LayerItem item = sender as LayerItem; if (item != null) { if (itemList.Contains(item.Target.ToString())) { itemList.Remove(item.Target.ToString()); } if (mapGis.DrawList.Count > 0) { var obj = mapGis.DrawList.Where(itm => itm.Key.StartsWith(item.Target.ToString() + "_")).ToList(); if (obj.Count > 0) { obj.ForEach(g => mapGis.MainMap.DefaultLayer.RemoveSymbolElement(g.Key)); } } } if (stpList.Children.Count == 0) { img_MouseLeftButtonUp(null, null); } }
private void setState(object sender, bool isChecked) { LayerItem litem = sender as LayerItem; if (litem == null) { return; } if (mapGis.DrawList.Count > 0) { var item = mapGis.DrawList.Where(itm => itm.Key.StartsWith(litem.Target + "_")).ToList(); if (item.Count > 0) { item.ForEach(g => mapGis.MainMap.DefaultLayer.ChangeSymbolElement(g.Key, isChecked)); } } }
public void Add(string title, string sKey) { if (itemList.Contains(sKey)) { return; } itemList.Add(sKey); LayerItem item = new LayerItem(); item.chk.Content = title; if (title == "其它") { item.btnClose.Visibility = System.Windows.Visibility.Visible; } item.chk.IsChecked = true; item.Target = sKey; item.Height = 28; item.ItemClose += ItemClose; item.ChkChecked += setState; this.stpList.Children.Add(item); }