protected void setLegend() { var lyt = LayoutView.Active?.Layout; if (lyt == null) return; QueuedTask.Run(() => { var def = lyt.GetDefinition(); var legend = def.Elements.OfType<CIMLegend>().FirstOrDefault(); if (legend != null) { //toggle auto visibility of all the legend items foreach (var leg_item in legend.Items) { leg_item.AutoVisibility = !leg_item.AutoVisibility; } //commit the change lyt.SetDefinition(def); } }); }
标签:lyt,leg,Pro,ArcGIS,图例,item,var,legend,def From: https://www.cnblogs.com/gisoracle/p/17320002.html