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


C# XamlType.GetAttachableMember方法代码示例

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


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

示例1: ReadMemberElement

		// member element, implicit member, children via content property, or value
		IEnumerable<XamlXmlNodeInfo> ReadMemberElement (XamlType parentType, XamlType xt)
		{
			XamlMember xm = null;
			var name = r.LocalName;
			int idx = name.IndexOf ('.');
			// FIXME: it skips strict type name check, as it could result in MarkupExtension mismatch (could be still checked, though)
			if (idx >= 0/* && name.Substring (0, idx) == xt.Name*/) {
				name = name.Substring (idx + 1);
				xm = xt.GetMember (name);
			} else {
				xm = (XamlMember) FindStandardDirective (name, AllowedMemberLocations.MemberElement) ??
					// not a standard directive? then try attachable
					xt.GetAttachableMember (name) ??
					// still not? then try ordinal member
					xt.GetMember (name);
				if (xm == null) {
					// still not? could it be omitted as content property or items ?
					if ((xm = GetExtraMember (xt)) != null) {
						// Note that this does not involve r.Read()
						foreach (var ni in ReadMember (xt, xm))
							yield return ni;
						yield break;
					}
				}
			}
			if (xm == null) {
				// Current element could be for another member in the parent type (if exists)
				if (parentType != null && parentType.GetMember (name) != null) {
					// stop the iteration and signal the caller to not read current element as an object. (It resolves conflicts between "start object for current collection's item" and "start member for the next member in the parent object".
					yield return Node (XamlNodeType.None, null);
					yield break;
				}

				// ok, then create unknown member.
				xm = new XamlMember (name, xt, false); // FIXME: not sure if isAttachable is always false.
			}

			if (!r.IsEmptyElement) {
				r.Read ();
				foreach (var ni in ReadMember (xt, xm))
					yield return ni;
				r.MoveToContent ();
				r.ReadEndElement ();
			}
			else
				r.Read ();
		}
开发者ID:gitter-badger,项目名称:Portable.Xaml,代码行数:48,代码来源:XamlXmlReader.cs

示例2: Read_AttachedProperty

		protected void Read_AttachedProperty (XamlReader r)
		{
			var at = new XamlType (typeof (Attachable), r.SchemaContext);

			Assert.IsTrue (r.Read (), "ns#1-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
			Assert.IsNotNull (r.Namespace, "ns#1-3");
			Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
			var assns = "clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
			Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");

			// t:AttachedWrapper
			Assert.IsTrue (r.Read (), "so#1-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
			var xt = new XamlType (typeof (AttachedWrapper), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");

			if (r is XamlXmlReader)
				ReadBase (r);

			ReadAttachedProperty (r, at.GetAttachableMember ("Foo"), "x", "x");

			// m:Value
			Assert.IsTrue (r.Read (), "sm#2-1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#sm#2-2");
			Assert.AreEqual (xt.GetMember ("Value"), r.Member, "sm#2-3");

			// t:Attached
			Assert.IsTrue (r.Read (), "so#2-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#so#2-2");
			Assert.AreEqual (r.SchemaContext.GetXamlType (typeof (Attached)), r.Type, "so#2-3");

			ReadAttachedProperty (r, at.GetAttachableMember ("Foo"), "y", "y");

			Assert.IsTrue (r.Read (), "eo#2-1");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#eo#2-2");

			// /m:Value
			Assert.IsTrue (r.Read (), "em#2-1");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#em#2-2");

			// /t:AttachedWrapper
			Assert.IsTrue (r.Read (), "eo#1-1");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#1-2");

			Assert.IsFalse (r.Read (), "end");
		}
开发者ID:imphasing,项目名称:mono,代码行数:47,代码来源:XamlReaderTestBase.cs

示例3: GetAttachableMember

 public XamlMember GetAttachableMember(XamlType xamlType, string name)
 {
     return xamlType.GetAttachableMember(name);
 }
开发者ID:gitter-badger,项目名称:OmniXAML,代码行数:4,代码来源:WiringContext.cs

示例4: XamlDomMember

        // XamlDomObject.GetMemberNode() needs to take a XamlType and string for supporting unknown attached members.
        // This constructor is here to match that.
        public XamlDomMember(XamlType declaringType, string attachedMember, params XamlDomItem[] items)
        {
            if (declaringType == null)
            {
                throw new ArgumentNullException("declaringType");
            }
            if (attachedMember == null)
            {
                throw new ArgumentNullException("attachedMember");
            }

            foreach (var itemNode in items)
            {
                Items.Add(itemNode);
            }

            var member = declaringType.GetAttachableMember(attachedMember);
            if (member == null)
            {
                throw new NotImplementedException("Unknown members are not implemented");
            }

            _member = member;
            Resolve();
        }
开发者ID:siwuxian,项目名称:WinObjC,代码行数:27,代码来源:XamlDomMember.cs

示例5: GetXamlAttachableProperty

 public XamlMember GetXamlAttachableProperty(XamlType xamlType, string propertyName)
 {
     if (xamlType.IsUnknown)
     {
         return null;
     }
     XamlMember attachableMember = xamlType.GetAttachableMember(propertyName);
     if (!this.IsVisible(attachableMember, null))
     {
         return null;
     }
     return attachableMember;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:XamlContext.cs


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