public override void Activate() { foreach (Button b in AddActionPanel.Children) { if (b.Tag != null) { BaseAction a = (BaseAction)System.Activator.CreateInstance(b.Tag as Type); if (a != null && !a.CheckActionFor(AdornedElement)) { b.IsEnabled = false; } else { b.IsEnabled = true; } } } FillActions(); visualChildren.Add(helperObject); base.Activate(); }