示例#1
0
        public override XamlType GetXamlType(Type type)
        {
            XamlType xamlType;

            if (typeCache.TryGetValue(type, out xamlType))
            {
                return(xamlType);
            }

            var info = type.GetTypeInfo();

            if (
                info.IsSubclassOf(typeof(Widget)) ||
                info.Assembly == EtoAssembly ||                 // struct
                (
                    // nullable struct
                    info.IsGenericType &&
                    info.GetGenericTypeDefinition() == typeof(Nullable <>) &&
                    Nullable.GetUnderlyingType(type).GetTypeInfo().Assembly == EtoAssembly
                ))
            {
                xamlType = new EtoXamlType(type, this);
                typeCache.Add(type, xamlType);
                return(xamlType);
            }
            return(base.GetXamlType(type));
        }
示例#2
0
 public override XamlType GetXamlType(Type type)
 {
     if (type.Assembly == typeof(Platform).Assembly)
     {
         XamlType xamlType;
         if (!typeCache.TryGetValue(type, out xamlType))
         {
             xamlType = new EtoXamlType(type, this);
             typeCache.Add(type, xamlType);
         }
         return(xamlType);
     }
     return(base.GetXamlType(type));
 }
示例#3
0
 public override XamlType GetXamlType(Type type)
 {
     // Use EtoXamlType for all types on mono so we can override incorrect behavior when getting collection
     // item types in EtoItemType.LookupItemType
     if (EtoEnvironment.Platform.IsMono || type.Assembly == typeof(Platform).Assembly)
     {
         XamlType xamlType;
         if (typeCache.TryGetValue(type, out xamlType))
         {
             return(xamlType);
         }
         xamlType = new EtoXamlType(type, this);
         typeCache.Add(type, xamlType);
         return(xamlType);
     }
     return(base.GetXamlType(type));
 }