当前位置: 首页>>代码示例>>C#>>正文


C# XamlType类代码示例

本文整理汇总了C#中XamlType的典型用法代码示例。如果您正苦于以下问题:C# XamlType类的具体用法?C# XamlType怎么用?C# XamlType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XamlType类属于命名空间,在下文中一共展示了XamlType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttributeParameterData

        public AttributeParameterData(XamlType type, object value)
        {
            ValidateType(type);
            if (value == null && type.UnderlyingType.IsValueType)
            {
                throw FxTrace.Exception.Argument("value", SR.AttributeValueNotNullable(type.UnderlyingType));
            }
            if (value != null && !type.UnderlyingType.IsAssignableFrom(value.GetType()))
            {
                throw FxTrace.Exception.Argument("value", SR.AttributeValueNotAssignableToType(value.GetType(), type.UnderlyingType));
            }

            this.Type = type;
            if (value != null)
            {
                if (type.UnderlyingType.IsArray)
                {
                    Array array = (Array)value;
                    XamlType elementType = type.SchemaContext.GetXamlType(type.UnderlyingType.GetElementType());
                    this.arrayContents = new List<AttributeParameterData>();
                    foreach (object item in array)
                    {
                        this.arrayContents.Add(new AttributeParameterData(elementType, item));
                    }
                    this.IsArray = true;
                }
                else
                {
                    this.Value = value;
                    this.TextValue = AttributeData.GetParameterText(value, type);
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:AttributeParameterData.cs

示例2: ForObject

 internal static XamlStackFrame ForObject(XamlType type)
 {
     XamlStackFrame result = new XamlStackFrame();
     result._data = type;
     result.FrameType = XamlStackFrameType.Object;
     return result;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:XamlStackWriter.cs

示例3: ConvertValueIfNecessary

        public object ConvertValueIfNecessary(object value, XamlType targetType)
        {
            if (IsAlreadyCompatible(value, targetType.UnderlyingType))
            {
                return value;
            }

            object converted;
            var success = TrySpecialConversion(value, targetType.UnderlyingType, out converted);
            if (success)
            {
                return converted;
            }

            var typeConverter = targetType.TypeConverter;
            if (typeConverter != null)
            {
                var context = new XamlTypeConverterContext(typeRepository, topDownValueContext);
                if (typeConverter.CanConvertFrom(context, value.GetType()))
                {
                    var anotherValue = typeConverter.ConvertFrom(context, CultureInfo.InvariantCulture, value);
                    return anotherValue;
                }
            }

            return value;
        }
开发者ID:rdterner,项目名称:OmniXAML,代码行数:27,代码来源:ValuePipeline.cs

示例4: Logic_StartElement

 private XamlNode Logic_StartElement(XamlType xamlType, string xamlNamespace)
 {
     this._context.PushScope();
     this._context.CurrentType = xamlType;
     this._context.CurrentTypeNamespace = xamlNamespace;
     return new XamlNode(XamlNodeType.StartObject, xamlType);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:MePullParser.cs

示例5: SetActivityType

        void SetActivityType(XamlType activityXamlType, XamlType activityBuilderXamlType)
        {
            if (activityXamlType == null)
            {
                this.notRewriting = true;
            }
            else
            {
                this.activityXamlType = activityXamlType;
                this.activityBuilderXamlType = activityBuilderXamlType;
                this.xamlTypeXamlType = this.SchemaContext.GetXamlType(typeof(XamlType));
                this.typeXamlType = this.SchemaContext.GetXamlType(typeof(Type));

                this.activityPropertyXamlType = this.SchemaContext.GetXamlType(typeof(DynamicActivityProperty));
                this.activityPropertyType = this.activityPropertyXamlType.GetMember("Type");
                this.activityPropertyName = this.activityPropertyXamlType.GetMember("Name");
                this.activityPropertyValue = this.activityPropertyXamlType.GetMember("Value");

                this.activityBuilderName = this.activityBuilderXamlType.GetMember("Name");
                this.activityBuilderAttributes = this.activityBuilderXamlType.GetMember("Attributes");
                this.activityBuilderProperties = this.activityBuilderXamlType.GetMember("Properties");
                this.activityBuilderPropertyReference = this.SchemaContext.GetXamlType(typeof(ActivityBuilder)).GetAttachableMember("PropertyReference");
                this.activityBuilderPropertyReferences = this.SchemaContext.GetXamlType(typeof(ActivityBuilder)).GetAttachableMember("PropertyReferences");
                this.activityPropertyReferenceXamlType = this.SchemaContext.GetXamlType(typeof(ActivityPropertyReference));
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:ActivityBuilderXamlWriter.cs

示例6: DynamicActivityXamlReader

 public DynamicActivityXamlReader(bool isBuilder, XamlReader innerReader, XamlSchemaContext schemaContext)
 {
     this.isBuilder = isBuilder;
     this.innerReader = innerReader;
     this.schemaContext = schemaContext ?? innerReader.SchemaContext;
     this.xamlTypeXamlType = this.schemaContext.GetXamlType(typeof(XamlType));
     this.typeXamlType = this.schemaContext.GetXamlType(typeof(System.Type));
     this.baseActivityXamlType = this.schemaContext.GetXamlType(typeof(Activity));
     this.activityPropertyXamlType = this.schemaContext.GetXamlType(typeof(DynamicActivityProperty));
     this.activityPropertyType = this.activityPropertyXamlType.GetMember("Type");
     this.activityPropertyName = this.activityPropertyXamlType.GetMember("Name");
     this.activityPropertyValue = this.activityPropertyXamlType.GetMember("Value");
     this.activityPropertyAttributes = this.activityPropertyXamlType.GetMember("Attributes");
     this.namespaceTable = new NamespaceTable();
     this.frontLoadedDirectives = true;
     this.nodeQueue = new XamlNodeQueue(this.schemaContext);
     this.nodeReader = this.nodeQueue.Reader;
     IXamlLineInfo info = innerReader as IXamlLineInfo;
     if ((info != null) && info.HasLineInfo)
     {
         this.innerReaderLineInfo = info;
         this.nodeReaderLineInfo = (IXamlLineInfo) this.nodeQueue.Reader;
         this.hasLineInfo = true;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:DynamicActivityXamlReader.cs

示例7: Crop

 private IEnumerable<Instruction> Crop(IEnumerable<Instruction> original, XamlType newType, XamlType oldType)
 {
     var list = original.ToList();
     var nodeToReplace = list.First(node => NodeHasSameType(oldType, node));
     var id = list.IndexOf(nodeToReplace);
     list[id] = instructionBuilder.StartObject(newType.UnderlyingType);
     return list;
 }
开发者ID:modulexcite,项目名称:OmniXAML,代码行数:8,代码来源:Hydrator.cs

示例8: XamlTypeInvoker

 public XamlTypeInvoker(XamlType type)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     this._xamlType = type;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XamlTypeInvoker.cs

示例9: XamlAttribute

        public XamlAttribute(UnboundAttribute unboundAttribute, XamlType type, IXamlTypeRepository typeContext)
        {
            Type = unboundAttribute.Type;
            Value = unboundAttribute.Value;
            Locator = unboundAttribute.Locator;

            Property = GetProperty(Locator, type, typeContext);
        }
开发者ID:gitter-badger,项目名称:OmniXAML,代码行数:8,代码来源:XamlAttribute.cs

示例10: ConvertArrayOfXamlTypesToTypes

 private Type[] ConvertArrayOfXamlTypesToTypes(XamlType[] typeArgs)
 {
     Type[] typeArray = new Type[typeArgs.Length];
     for (int i = 0; i < typeArgs.Length; i++)
     {
         typeArray[i] = typeArgs[i].UnderlyingType;
     }
     return typeArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XamlNamespace.cs

示例11: XamlDirective

 public XamlDirective(IEnumerable<string> xamlNamespaces, string name, XamlType xamlType, XamlValueConverter<TypeConverter> typeConverter, AllowedMemberLocations allowedLocation) : base(name, new MemberReflector(xamlType, typeConverter))
 {
     if (xamlType == null)
     {
         throw new ArgumentNullException("xamlType");
     }
     this._xamlNamespaces = GetReadOnly(xamlNamespaces);
     this._allowedLocation = allowedLocation;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XamlDirective.cs

示例12: XamlValidatingReader

 public XamlValidatingReader(XamlReader underlyingReader, Assembly assembly, string rootNamespace, string realAssemblyName)
     : base(underlyingReader)
 {
     this.assembly = assembly;
     this.definedType = null;
     this.rootNamespace = rootNamespace;
     this.localAssemblyName = assembly != null ? assembly.GetName().Name : null;
     this.realAssemblyName = realAssemblyName;
     this.xNull = underlyingReader.SchemaContext.GetXamlType(new XamlTypeName(XamlLanguage.Null));
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:XamlValidatingReader.cs

示例13: CommonNodesOfElement

        private IEnumerable<ProtoXamlNode> CommonNodesOfElement(XamlType owner, ProtoXamlNode elementToInject, AttributeFeed attributeFeed)
        {
            var attributes = attributeFeed;

            foreach (var node in attributes.PrefixRegistrations.Select(ConvertAttributeToNsPrefixDefinition)) yield return node;

            yield return elementToInject;

            foreach (var node in attributes.RawAttributes.Select(a => ConvertAttributeToNode(owner, a))) yield return node;
        }
开发者ID:gitter-badger,项目名称:OmniXAML,代码行数:10,代码来源:SuperProtoParser.cs

示例14: NodeHasSameType

        private static bool NodeHasSameType(XamlType oldType, XamlNode node)
        {
            var xamlType = node.XamlType;
            if (xamlType != null)
            {
                var nodeHasSameType = xamlType.Equals(oldType);
                return nodeHasSameType;
            }

            return false;
        }
开发者ID:danwalmsley,项目名称:OmniXAML,代码行数:11,代码来源:NodeInflater.cs

示例15: MemberReflector

 internal MemberReflector(XamlType type, XamlValueConverter<System.ComponentModel.TypeConverter> typeConverter)
 {
     this.Type = type;
     this._typeConverter.Value = typeConverter;
     this._designerSerializationVisibility = DesignerSerializationVisibility.Visible;
     this._memberBits = -65440;
     this._deferringLoader.Value = null;
     this._getter.Value = null;
     this._setter.Value = null;
     this._valueSerializer.Value = null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:MemberReflector.cs


注:本文中的XamlType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。