本文整理汇总了C#中System.Xaml.XamlMember类的典型用法代码示例。如果您正苦于以下问题:C# XamlMember类的具体用法?C# XamlMember怎么用?C# XamlMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XamlMember类属于System.Xaml命名空间,在下文中一共展示了XamlMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XamlSetTypeConverterEventArgs
public XamlSetTypeConverterEventArgs (XamlMember member, TypeConverter typeConverter, object value, ITypeDescriptorContext serviceProvider, CultureInfo cultureInfo)
: base (member, value)
{
CultureInfo = cultureInfo;
ServiceProvider = serviceProvider;
TypeConverter = typeConverter;
}
示例2: XamlDomMember
public XamlDomMember(XamlMember xamlMember)
{
_member = xamlMember;
if (xamlMember != null)
{
_schemaContext = xamlMember.Type.SchemaContext;
}
}
示例3: XamlMemberInvoker
public XamlMemberInvoker(XamlMember member)
{
if (member == null)
{
throw new ArgumentNullException("member");
}
this._member = member;
}
示例4: LookupPrefix
private string LookupPrefix(XamlMember property)
{
string str;
string prefix = this.xamlXmlWriter.LookupPrefix(property.GetXamlNamespaces(), out str);
if ((prefix == null) && !this.meSettings.ContinueWritingWhenPrefixIsNotFound)
{
this.failed = true;
return string.Empty;
}
return prefix;
}
示例5: CheckMemberForUniqueness
private void CheckMemberForUniqueness(Node objectNode, XamlMember property)
{
if (!this.settings.AssumeValidInput)
{
if (objectNode.Members == null)
{
objectNode.Members = new XamlPropertySet();
}
else if (objectNode.Members.Contains(property))
{
throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterDuplicateMember", new object[] { property.Name }));
}
objectNode.Members.Add(property);
}
}
示例6: AddDependencyForUnresolvedChildren
private void AddDependencyForUnresolvedChildren(object childThatHasUnresolvedChildren, XamlMember property, object parentInstance, XamlType parentType, bool parentIsGotten, XamlSavedContext deferredMarkupExtensionContext)
{
if (((property != null) && property.IsDirective) && ((parentInstance == null) && (property != XamlLanguage.Key)))
{
List<string> result = new List<string>();
this._nameFixupGraph.GetDependentNames(childThatHasUnresolvedChildren, result);
string str = string.Join(", ", result.ToArray());
throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("TransitiveForwardRefDirectives", new object[] { childThatHasUnresolvedChildren.GetType(), property, str })));
}
NameFixupToken token = this.GetTokenForUnresolvedChildren(childThatHasUnresolvedChildren, property, deferredMarkupExtensionContext);
token.Target.Instance = parentInstance;
token.Target.InstanceType = parentType;
token.Target.InstanceWasGotten = parentIsGotten;
this.PendCurrentFixupToken_SetValue(token);
}
示例7: Set
internal void Set(XamlMember member)
{
if (FrameType != XamlStackFrameType.Object && FrameType != XamlStackFrameType.GetObject)
{
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnexpectedXaml));
}
HashSet<XamlMember> setMembers = _isSet as HashSet<XamlMember>;
if (setMembers == null)
{
setMembers = new HashSet<XamlMember>();
_isSet = setMembers;
}
if (!setMembers.Contains(member))
{
setMembers.Add(member);
}
}
示例8: Logic_PushAndPopAProvideValueStackFrame
private object Logic_PushAndPopAProvideValueStackFrame(ObjectWriterContext ctx, XamlMember prop, MarkupExtension me, bool useIRME)
{
XamlMember currentProperty = ctx.CurrentProperty;
ctx.CurrentProperty = prop;
ctx.PushScope();
ctx.CurrentInstance = me;
object obj2 = null;
if (useIRME)
{
this.Logic_AssignProvidedValue(ctx);
}
else
{
obj2 = this.Runtime.CallProvideValue(me, ctx.ServiceProviderContext);
}
ctx.PopScope();
ctx.CurrentProperty = currentProperty;
return obj2;
}
示例9: Logic_CreateFromValue
private object Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter<TypeConverter> typeConverter, object value, XamlMember property, string targetName, IAddLineInfo lineInfo)
{
object obj3;
try
{
obj3 = this.Runtime.CreateFromValue(ctx.ServiceProviderContext, typeConverter, value, property);
}
catch (Exception exception)
{
if (CriticalExceptions.IsCriticalException(exception))
{
throw;
}
string message = System.Xaml.SR.Get("TypeConverterFailed", new object[] { targetName, value });
throw lineInfo.WithLineInfo(new XamlObjectWriterException(message, exception));
}
return obj3;
}
示例10: Logic_ApplyPropertyValue
private void Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, object value, bool onParent)
{
object inst = onParent ? ctx.ParentInstance : ctx.CurrentInstance;
if (value is XData)
{
XData xData = value as XData;
if (prop.Type.IsXData)
{
this.Runtime.SetXmlInstance(inst, prop, xData);
return;
}
value = xData.Text;
}
this.SetValue(inst, prop, value);
if (prop.IsDirective)
{
XamlMember aliasedProperty = (onParent ? ctx.ParentType : ctx.CurrentType).GetAliasedProperty(prop as XamlDirective);
if ((prop != XamlLanguage.Key) && (aliasedProperty != null))
{
this.Logic_DuplicatePropertyCheck(ctx, aliasedProperty, onParent);
object obj3 = this.Logic_CreateFromValue(ctx, aliasedProperty.TypeConverter, value, aliasedProperty, aliasedProperty.Name);
this.SetValue(inst, aliasedProperty, obj3);
}
if (prop == XamlLanguage.Name)
{
if (inst == ctx.CurrentInstance)
{
this.Logic_RegisterName_OnCurrent(ctx, (string) value);
}
else
{
this.Logic_RegisterName_OnParent(ctx, (string) value);
}
}
else if (prop == XamlLanguage.ConnectionId)
{
this.Logic_SetConnectionId(ctx, (int) value, inst);
}
else if (prop == XamlLanguage.Base)
{
this.Logic_CheckBaseUri(ctx, (string) value);
ctx.BaseUri = new Uri((string) value);
if (ctx.ParentInstance != null)
{
this.Runtime.SetUriBase(ctx.ParentType, ctx.ParentInstance, ctx.BaseUri);
}
}
}
}
示例11: IsTextConstructionDirective
private bool IsTextConstructionDirective(XamlMember xamlMember)
{
if (((xamlMember != XamlLanguage.Arguments) && (xamlMember != XamlLanguage.FactoryMethod)) && (xamlMember != XamlLanguage.PositionalParameters))
{
return (xamlMember == XamlLanguage.TypeArguments);
}
return true;
}
示例12: IsDirectiveAllowedOnNullInstance
private bool IsDirectiveAllowedOnNullInstance(XamlMember xamlMember, XamlType xamlType)
{
return ((xamlMember == XamlLanguage.Key) || ((xamlMember == XamlLanguage.Uid) && (null == xamlType.GetAliasedProperty(XamlLanguage.Uid))));
}
示例13: TestMemberCommon
void TestMemberCommon (XamlMember m, string name, Type type, Type declType, bool hasSetter)
{
Assert.IsNotNull (m, "#1");
Assert.IsNotNull (m.DeclaringType, "#2");
Assert.AreEqual (declType, m.DeclaringType.UnderlyingType, "#2-2");
Assert.IsNotNull (m.Invoker, "#3");
Assert.IsNotNull (m.Invoker.UnderlyingGetter, "#3-2");
if (hasSetter)
Assert.IsNotNull (m.Invoker.UnderlyingSetter, "#3-3");
else
Assert.IsNull (m.Invoker.UnderlyingSetter, "#3-3");
Assert.IsFalse (m.IsUnknown, "#4");
Assert.IsTrue (m.IsReadPublic, "#5");
Assert.AreEqual (hasSetter, m.IsWritePublic, "#6");
Assert.AreEqual (name, m.Name, "#7");
Assert.IsTrue (m.IsNameValid, "#8");
Assert.AreEqual (XamlLanguage.Xaml2006Namespace, m.PreferredXamlNamespace, "#9");
// use declType here (mostly identical to targetType)
Assert.AreEqual (new XamlType (declType, m.TargetType.SchemaContext), m.TargetType, "#10");
Assert.IsNotNull (m.Type, "#11");
Assert.AreEqual (type, m.Type.UnderlyingType, "#11-2");
// Property.Type is a special case here.
if (name == "Type" && m.DeclaringType != XamlLanguage.Property)
Assert.AreEqual (m.Type.TypeConverter, m.TypeConverter, "#12");
// String type is a special case here.
if (type == typeof (string))
Assert.AreEqual (m.Type.ValueSerializer, m.ValueSerializer, "#13a");
else
Assert.IsNull (m.ValueSerializer, "#13b");
Assert.IsNull (m.DeferringLoader, "#14");
Assert.IsNotNull (m.UnderlyingMember, "#15");
Assert.AreEqual (!hasSetter, m.IsReadOnly, "#16");
Assert.IsFalse (m.IsWriteOnly, "#17");
Assert.IsFalse (m.IsAttachable, "#18");
Assert.IsFalse (m.IsEvent, "#19");
Assert.IsFalse (m.IsDirective, "#20");
Assert.IsNotNull (m.DependsOn, "#21");
Assert.AreEqual (0, m.DependsOn.Count, "#21-2");
Assert.IsFalse (m.IsAmbient, "#22");
}
示例14: GetNodes
IEnumerable<XamlNodeInfo> GetNodes (XamlMember xm, XamlObject xobj)
{
return GetNodes (xm, xobj, null, false);
}
示例15: GetItemsNodes
IEnumerable<XamlNodeInfo> GetItemsNodes (XamlMember xm, XamlObject xobj)
{
var obj = xobj.GetRawValue ();
if (obj == null)
yield break;
var ie = xobj.Type.Invoker.GetItems (obj);
while (ie.MoveNext ()) {
var iobj = ie.Current;
// If it is dictionary, then retrieve the key, and rewrite the item as the Value part.
object ikey = null;
if (xobj.Type.IsDictionary) {
Type kvpType = iobj.GetType ();
bool isNonGeneric = kvpType == typeof (DictionaryEntry);
var kp = isNonGeneric ? null : kvpType.GetProperty ("Key");
var vp = isNonGeneric ? null : kvpType.GetProperty ("Value");
ikey = isNonGeneric ? ((DictionaryEntry) iobj).Key : kp.GetValue (iobj, null);
iobj = isNonGeneric ? ((DictionaryEntry) iobj).Value : vp.GetValue (iobj, null);
}
var wobj = TypeExtensionMethods.GetExtensionWrapped (iobj);
var xiobj = new XamlObject (GetType (wobj), wobj);
if (ikey != null) {
// Key member is written *inside* the item object.
//
// It is messy, but Key and Value are *sorted*. In most cases Key goes first, but for example PositionalParameters comes first.
// To achieve this behavior, we compare XamlLanguage.Key and value's Member and returns in order. It's all nasty hack, but at least it could be achieved like this!
var en = GetNodes (null, xiobj).ToArray ();
yield return en [0]; // StartObject
var xknm = new XamlNodeMember (xobj, XamlLanguage.Key);
var nodes1 = en.Skip (1).Take (en.Length - 2);
var nodes2 = GetKeyNodes (ikey, xobj.Type.KeyType, xknm);
foreach (var xn in EnumerateMixingMember (nodes1, XamlLanguage.Key, nodes2))
yield return xn;
yield return en [en.Length - 1];
}
else
foreach (var xn in GetNodes (null, xiobj))
yield return xn;
}
}