>>>public class LLCommands >>>{ >>> private static RoutedUICommand lockDown; >>> >>> static LLCommands() >>> { lockDown = new RoutedUICommand("LockDown","LockDown",typeof(LLCommands)); } >>> >>> public static RoutedUICommand LockDown >>> { get {return lockDown; } } >>>}elsewhere:
List<RoutedUICommands>() SupportedCommands; >>>SupportedCommands.Add(LLCommands.LockDown);So far, so good. But how can I achieve the add given only a string (e.g "LLCommands.LockDown") ?
Type t = typeof(LLCommands); > PropertyInfo p = t.GetProperty("LockDown", BindingFlags.Public | BindingFlags.Static); > RoutedUICommand r = (RoutedUICommand) p.GetValue(LLCommands.LockDown,null); > SupportedCommands.Add(r);>obviously needs a bit of exception handling tho.....