private void HelpCmm(ObservableCollection <IIMenuItem> t) { // ContextMenu Cm = new ContextMenu(); // Cm.Items.Clear(); var gg = MenuBuilding.HelpCmm(t); foreach (var f in gg) { Cm.Items.Add(f); } return; foreach (var f in t) { if (f.CmItems != null && f.CmItems.Count > 0) { var ggg = helpCmmm(f); ggg.Header = f.Text; Cm.Items.Add(ggg); } else { MenuItem mii = new MenuItem(); mii.Header = f.Text; mii.IsCheckable = f.IsCheckable; mii.IsEnabled = f.IsEnabled; mii.ToolTip = f.Tooltips; mii.Command = f.Command; Cm.Items.Add(mii); } } return; }
/// <summary> /// 菜单 /// </summary> public ContextMenu GetCm(List <int> rtulst, List <int> slulst, Dictionary <int, List <int> > sluctrllst) { if (Cm == null) { Cm = new ContextMenu(); Cm.BorderThickness = new Thickness(0); } Cm.Items.Clear(); if (rtulst != null && rtulst.Count > 0) { var t = MenuBuilding.BulidCm("30500", false, rtulst); var gg = MenuBuilding.HelpCmm(t); foreach (var f in gg) { Cm.Items.Add(f); } } if (slulst != null && slulst.Count > 0) { var t = MenuBuilding.BulidCm("20901", false, slulst); var gg = MenuBuilding.HelpCmm(t); foreach (var f in gg) { Cm.Items.Add(f); } } if (sluctrllst != null && sluctrllst.Count > 0) { var t = MenuBuilding.BulidCm("20902", false, sluctrllst); var gg = MenuBuilding.HelpCmm(t); foreach (var f in gg) { Cm.Items.Add(f); } } var mi = new MenuItem(); mi.Header = "混合菜单"; mi.IsEnabled = false; if (Cm.Items.Count > 0) { Cm.Items.Insert(0, mi); } else { Cm.Items.Add(mi); } return(Cm); }
protected void Helpcmmm(ObservableCollection <IIMenuItem> t) { var fs = MenuBuilding.HelpCmm(t); Items.Clear(); foreach (var g in fs) { Items.Add(g); } }
protected void HelpCmm(ObservableCollection <IIMenuItem> t) { Cm.Items.Clear(); var infos = MenuBuilding.HelpCmm(t); foreach (var g in infos) { this.Cm.Items.Add(g); } }