1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Presentation
7 using System.Diagnostics.CodeAnalysis;
11 using System.Collections.Generic;
14 // The ContextItem class is the base class from which all context items must derive.
16 public abstract class ContextItem
20 // Creates a new ContextItem.
22 protected ContextItem()
27 // Returns the item type for this editing context item. Context items are
28 // considered unique based on their item type. By using ItemType to identify
29 // a type of context item we allow several derived versions of context items to
30 // be cataloged under the same key in the editing context.
33 public abstract Type ItemType
37 // This method is called on a context item before it is stored in the context item
38 // manager. The previous item in the context item manager is passed.
40 // <param name="context">The editing context that is making this change.</param>
41 // <param name="previousItem">The previously active item in the context. Because items must have default constructors a default item will be fabricated if an item is first passed into the context.</param>
42 // <returns></returns>
43 protected virtual void OnItemChanged(EditingContext context, ContextItem previousItem)
48 // Internal API that calls OnItemChanged. This is invoked from the
49 // abstract ContextItemManager class so deriving classes can still
52 internal void InvokeOnItemChanged(EditingContext context, ContextItem previousItem)
54 OnItemChanged(context, previousItem);