public XamlValueConverter<ValueSerializer> ValueSerializer {
get { return LookupValueSerializer (); }
}
+
+ internal bool IsConstructorArgument {
+ get {
+ var ap = GetCustomAttributeProvider ();
+ return ap != null && ap.GetCustomAttributes (typeof (ConstructorArgumentAttribute), false).Length > 0;
+ }
+ }
public static bool operator == (XamlMember left, XamlMember right)
{
int CompareMembers (XamlMember m1, XamlMember m2)
{
+ // ConstructorArguments and PositionalParameters go first.
+ if (m1 == XamlLanguage.PositionalParameters)
+ return -1;
+ if (m2 == XamlLanguage.PositionalParameters)
+ return 1;
+ if (m1.IsConstructorArgument) {
+ if (!m2.IsConstructorArgument)
+ return -1;
+ }
+ else if (m2.IsConstructorArgument)
+ return 1;
+
// ContentProperty is returned at last.
if (m1.DeclaringType.ContentProperty == m1)
return 1;
- else if (m2.DeclaringType.ContentProperty == m2)
+ if (m2.DeclaringType.ContentProperty == m2)
return -1;
+ // compare collection kind
+ var t1 = m1.Type;
+ var t2 = m2.Type;
+ int coll1 = t1.IsDictionary ? 3 : t1.IsCollection ? 2 : t1.IsArray ? 1 : 0;
+ int coll2 = t2.IsDictionary ? 3 : t2.IsCollection ? 2 : t2.IsArray ? 1 : 0;
+ if (coll1 != coll2)
+ return coll2 - coll1;
+
// then, compare names.
return String.CompareOrdinal (m1.Name, m2.Name);
}
{
this.Type = type;
}
-
- [ConstructorArgument ("type")]
- public Type Type { get; set; }
IList items;
public IList Items {
private set { items = value; }
}
+ [ConstructorArgument ("type")]
+ public Type Type { get; set; }
+
public override object ProvideValue (IServiceProvider serviceProvider)
{
if (Type == null)