/// <summary> /// Occurs when a clone creation is first requested. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">An <c>ItemRoutedEventArgs</c> that contains the event data.</param> private static void OnCloneCreatingEvent(object sender, DependencyObjectItemRoutedEventArgs e) { MainControl control = (MainControl)sender; // You can create your own clone of the source object here or instead let Ribbon create one for you that will be passed to CloneCreated control.eventsListBox.Items.Insert(0, String.Format("CloneCreating: {0}", e.OriginalSource)); }
/// <summary> /// Occurs when a clone is being disposed (tracking by CloneService is done). /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">An <c>ItemRoutedEventArgs</c> that contains the event data.</param> private static void OnCloneDisposedEvent(object sender, DependencyObjectItemRoutedEventArgs e) { MainControl control = (MainControl)sender; // Remove any event handlers for the cloned control here... the cloned control is in e.Item control.eventsListBox.Items.Insert(0, String.Format("CloneDisposed: {0}", e.OriginalSource)); }
/// <summary> /// Occurs right before a clone is about to be readied for use. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">An <c>ItemRoutedEventArgs</c> that contains the event data.</param> private static void OnCloneCreatedEvent(object sender, DependencyObjectItemRoutedEventArgs e) { MainControl control = (MainControl)sender; // Modify the properties of the clones control or attach to any events here... the cloned control is in e.Item control.eventsListBox.Items.Insert(0, String.Format("CloneCreated: {0}", e.OriginalSource)); }