/// <summary> /// Retrieves the mapping collection /// </summary> /// <param name="obj"></param> /// <returns></returns> internal static CommandEventCollection InternalGetMappingCollection(DependencyObject obj) { var map = obj.GetValue(MappingsProperty) as CommandEventCollection; if (map == null) { map = new CommandEventCollection(); SetMappings(obj, map); } return map; }
/// <summary> /// Hooks the event maps /// </summary> private void HookEvents() { var mappings = EventCommander.GetMappings(AssociatedObject); if (mappings == null) { mappings = new CommandEventCollection(); EventCommander.SetMappings(AssociatedObject, mappings); } _commandEvent = new CommandEvent { Command = this, CommandParameter = this.CommandParameter, Event = this.Event }; mappings.Add(_commandEvent); }
/// <summary> /// This sets the mapping collection. /// </summary> /// <param name="obj">Dependency Object</param> /// <param name="value">Mapping collection</param> public static void SetMappings(DependencyObject obj, CommandEventCollection value) { obj.SetValue(MappingsProperty, value); }