public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager) { base.DeepCopy(source, copyManager); CommandBaseMarkupExtension cbme = (CommandBaseMarkupExtension)source; _source.Source = copyManager.GetCopy(cbme._source.Source); _source.ElementName = cbme._source.ElementName; _source.RelativeSource = cbme._source.RelativeSource; _path = cbme._path; _compiledPath = cbme._compiledPath; _source.Converter = copyManager.GetCopy(cbme._source.Converter); _source.ConverterParameter = copyManager.GetCopy(cbme._source.ConverterParameter); }
/// <summary> /// Will create an event handler association for the current element, using a command markup extension as handler. /// </summary> /// <param name="obj">Object which defines the event to assign the event /// handler specified by <paramref name="cmdExtension"/> to.</param> /// <param name="evt">Event which is defined on the class of <paramref name="obj"/>.</param> /// <param name="cmdExtension">Command extension to be used as event handler.</param> protected void HandleEventAssignment(object obj, EventInfo evt, CommandBaseMarkupExtension cmdExtension) { try { // initialize command extension ((IEvaluableMarkupExtension)cmdExtension).Initialize(this); // get the delegate from the command extension var dlgt = cmdExtension.GetDelegate(evt.EventHandlerType); // add the event handler to the event evt.AddEventHandler(obj, dlgt); } catch (Exception e) { throw new XamlBindingException("Error assigning event handler", e); } }