本文整理汇总了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);
}
}
}
示例2: ForObject
internal static XamlStackFrame ForObject(XamlType type)
{
XamlStackFrame result = new XamlStackFrame();
result._data = type;
result.FrameType = XamlStackFrameType.Object;
return result;
}
示例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;
}
示例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);
}
示例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));
}
}
示例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;
}
}
示例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;
}
示例8: XamlTypeInvoker
public XamlTypeInvoker(XamlType type)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
this._xamlType = type;
}
示例9: XamlAttribute
public XamlAttribute(UnboundAttribute unboundAttribute, XamlType type, IXamlTypeRepository typeContext)
{
Type = unboundAttribute.Type;
Value = unboundAttribute.Value;
Locator = unboundAttribute.Locator;
Property = GetProperty(Locator, type, typeContext);
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}