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


C# XamlType类代码示例

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



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


示例16: CommonNodesOfElement

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

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

            yield return elementToInject;

            foreach (var instruction in attributes.Directives.Select(ConvertDirective)) yield return instruction;
            foreach (var instruction in attributes.RawAttributes.Select(a => ConvertAttributeToNode(owner, a))) yield return instruction;
        }
开发者ID:rdterner,项目名称:OmniXAML,代码行数:11,代码来源:XamlProtoInstructionParser.cs


示例17: WpfKnownMember

 public WpfKnownMember(XamlSchemaContext schema,
     XamlType declaringType,
     string name,
     Type type,
     bool isReadOnly,
     bool isAttachable)
     : base(name, declaringType, isAttachable)
 {
     _type = type;
     ReadOnly = isReadOnly;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:WpfKnownMember.cs


示例18: NodeHasSameType

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

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


示例19: LookupPrefix

 private string LookupPrefix(XamlType type)
 {
     string str;
     string prefix = this.xamlXmlWriter.LookupPrefix(type.GetXamlNamespaces(), out str);
     if ((prefix == null) && !this.meSettings.ContinueWritingWhenPrefixIsNotFound)
     {
         this.failed = true;
         return string.Empty;
     }
     return prefix;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:XamlMarkupExtensionWriter.cs


示例20: GetContentProperty

        private XamlMember GetContentProperty(XamlType parentType)
        {
            var propertyName = wiringContext.ContentPropertyProvider.GetContentPropertyName(parentType.UnderlyingType);

            if (propertyName == null)
            {
                return null;
            }

            var member = wiringContext.TypeContext.GetXamlType(parentType.UnderlyingType).GetMember(propertyName);
            return member;
        }
开发者ID:danwalmsley,项目名称:OmniXAML,代码行数:12,代码来源:XamlNodesPullParser.cs



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