private void loadCtx(Panel prophld, object ctrl) { if (proplist == null) LoadPropList(ctrl); if (prophld == null) return; ctm.Tag = prophld; prophld.Children.Clear(); prophld.ContextMenu = ctm; bool toped = false, lefted = false; foreach (var category in proplist) { var lb = new Label(); lb.Content = category.Key; lb.Style = (Style)lb.FindResource("PropCatStyle"); prophld.Children.Add(lb); lb = new Label(); lb.Style = (Style)lb.FindResource("PropCatStyle"); prophld.Children.Add(lb);//balance it category.Value.Sort(); foreach (var itm in category.Value) { //Sneak in the Canvas.Left and Canvas.Top into the property editors if (category.Key == "Layout") { if (!lefted && string.Compare("Left", itm.Name) < 0) { var entt = GetTLBox(false); prophld.Children.Add(entt[0]); prophld.Children.Add(entt[1]);//TODO: this will break if there is not 2 } if (!toped && string.Compare("Top", itm.Name) < 0) { var entt = GetTLBox(true); prophld.Children.Add(entt[0]); prophld.Children.Add(entt[1]);//TODO: this will break if there is not 2 } } var ent = itm.GetEntry(); prophld.Children.Add(ent[0]); prophld.Children.Add(ent[1]);//TODO: this will break if there is not 2 } } }