1 namespace System.Activities.Presentation.PropertyEditing {
3 using System.ComponentModel;
5 using System.Activities.Presentation;
6 using System.Diagnostics.CodeAnalysis;
9 /// This class is used to set the order in which properties show up within a category,
10 /// or within a list of sub-properties. 3rd parties may choose to derive from this class
11 /// and create their own custom order tokens, which can both guarantee property order as
12 /// well as property grouping.
14 [Fx.Tag.XamlVisible(false)]
15 sealed class PropertyOrder : OrderToken
17 private static PropertyOrder _default;
20 /// Creates a PropertyOrder.
22 /// <param name="precedence">Precedence of this token based on the
23 /// referenced token.</param>
24 /// <param name="reference">Referenced token.</param>
25 /// <param name="conflictResolution">Conflict resolution semantics.
26 /// Winning ConflictResultion semantic should only be used
27 /// on predefined, default OrderToken instances to ensure
28 /// their correct placement in more complex chain of order
29 /// dependencies.</param>
30 private PropertyOrder(OrderTokenPrecedence precedence, OrderToken reference, OrderTokenConflictResolution conflictResolution)
31 : base(precedence, reference, conflictResolution) {
35 /// Creates a PropertyOrder that comes after the passed in token.
37 /// <param name="reference">The reference token</param>
38 /// <returns>The new PropertyOrder</returns>
39 /// <exception cref="ArgumentNullException">When reference is null</exception>
40 public static PropertyOrder CreateAfter(OrderToken reference)
42 if (reference == null)
43 throw FxTrace.Exception.ArgumentNull("reference");
45 return new PropertyOrder(OrderTokenPrecedence.After, reference, OrderTokenConflictResolution.Lose);
49 /// Treat equal orders as equal
51 /// <param name="left">Left token</param>
52 /// <param name="right">Right token</param>
53 /// <returns>0</returns>
54 protected override int ResolveConflict(OrderToken left, OrderToken right) {
59 /// Gets the system defined Default order position.
61 public static PropertyOrder Default {
63 if (_default == null) {
64 _default = new PropertyOrder(OrderTokenPrecedence.After, null, OrderTokenConflictResolution.Win);