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


C# Xaml.XamlObjectElement类代码示例

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


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

示例1: RegisterNamedItem

		internal void RegisterNamedItem (XamlObjectElement element, string name)
		{
			IDictionary rd = CurrentDictionary (element);
			if (rd != null && element.X_Key != null) {
				throw ParseException ("The name already exists in the tree.");
			}

			if (element.X_Name != null) {
				throw ParseException ("Cannot specify both Name and x:Name attributes.");
			}

			element.X_Name = name;

			FrameworkElement fe = element.FrameworkElement;
			if (fe != null)
				fe.SetNameOnScope (name, NameScope);
		}
开发者ID:shana,项目名称:moon,代码行数:17,代码来源:XamlParser.cs

示例2: Create

		public static XamlAttachedPropertySetter Create (XamlObjectElement element, Accessors accessors)
		{
			if (accessors == null)
				return null;
			return new XamlAttachedPropertySetter (element, accessors);
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:6,代码来源:XamlPropertySetter.cs

示例3: SetValue

		public override void SetValue (XamlObjectElement obj, object value)
		{
			var mutable = value as MutableObject;
			if (mutable != null)
				value = mutable.Object;

			if (!typeof (Binding).IsAssignableFrom (Type)) {
				Binding binding = value as Binding;
				if (binding != null) {
					SetBinding (binding, Element.Object);
					return;
				}
			}

			if (!typeof (TemplateBindingExpression).IsAssignableFrom (Type)) {
				TemplateBindingExpression tb = value as TemplateBindingExpression;
				if (tb != null) {
					SetTemplateBinding (tb, obj.Object);
					return;
				}
			}

			if (value == null || Type.IsAssignableFrom (value.GetType ())) {
				Accessors.Setter (Element.Object, ConvertValue (Type, value));
				return;
			}
				
			if (typeof (IList).IsAssignableFrom (Type)) {
				AddToCollection (value);
				return;
			}

			throw new XamlParseException (
				string.Format ("XamlAttachedPropertySetter.SetValue: Could not set value '{0}' to the attached property '{1}.{2}'",
					value,
					Accessors.DeclaringType,
					Accessors.Name)
			);
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:39,代码来源:XamlPropertySetter.cs

示例4: XamlReflectionEventSetter

		public XamlReflectionEventSetter (XamlObjectElement element, object target, EventInfo evnt) : base (element, evnt.Name,
				Helper.GetConverterFor (evnt, evnt.EventHandlerType))
		{
			this.target = target;
			this.evnt = evnt;
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:6,代码来源:XamlPropertySetter.cs

示例5: XamlNamePropertySetter

		public XamlNamePropertySetter (XamlObjectElement element, DependencyObject target) : base (element, "Name", null)
		{
			this.target = target;
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:4,代码来源:XamlPropertySetter.cs

示例6: XamlReflectionPropertySetter

		XamlReflectionPropertySetter (XamlObjectElement element, object target, Accessors accessors) : base (element, accessors.Name, accessors.ConverterCreator == null ? null : accessors.ConverterCreator ())
		{
			this.target = target;
			this.accessors = accessors;

			if (target is MutableObject)
				is_mutable = true;
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:8,代码来源:XamlPropertySetter.cs

示例7: AddToCollection

		private void AddToCollection (XamlObjectElement obj, object value)
		{
			IList list = accessors.Getter (target) as IList;
			if (list == null) {
				throw Parser.ParseException ("Collection property in non collection type.");
			}

			list.Add (value);
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:9,代码来源:XamlPropertySetter.cs

示例8: ParseXAttribute

		private void ParseXAttribute (XamlObjectElement element)
		{
			switch (reader.LocalName) {
			case "Key":
				RegisterKeyItem (element, element.Parent, reader.Value);
				return;
			case "Name":
				RegisterNamedItem (element, reader.Value);
				return;
			case "Class":
				// The class attribute is handled when we initialize the element
				return;
			default:
				throw ParseException ("Unknown x: attribute ({0}).", reader.LocalName);
			}
		}
开发者ID:shana,项目名称:moon,代码行数:16,代码来源:XamlParser.cs

示例9: ParseAttributeValue

		private object ParseAttributeValue (XamlObjectElement element, XamlPropertySetter property)
		{
			object value = null;

			if (IsMarkupExpression (reader.Value))
				value = ParseAttributeMarkup (element, property);
			else {
				value = XamlTypeConverter.ConvertObject (this, element, property.Type, property.Converter, property.Name, reader.Value);
			}

			return value;
		}
开发者ID:shana,项目名称:moon,代码行数:12,代码来源:XamlParser.cs

示例10: ParseElementAttributes

		private void ParseElementAttributes (XamlObjectElement element)
		{
			if (!reader.HasAttributes)
				return;

			try {
				int ac = reader.AttributeCount;
				for (int i = 0; i < reader.AttributeCount; i++) {
					reader.MoveToAttribute (i);
					ParseAttribute (element);
				}
			} finally {
				// We do this in a finally so error reporting doesn't get all jacked up
				reader.MoveToElement();
			}
		}
开发者ID:shana,项目名称:moon,代码行数:16,代码来源:XamlParser.cs

示例11: ParseAttribute

		private void ParseAttribute (XamlObjectElement element)
		{
			if (IsMcAttribute ()) {
				ParseMcAttribute (element);
				return;
			}
			if (IsXmlnsMapping ()) {
				ParseXmlnsMapping (element);
				return;
			}

			if (IsXAttribute ()) {
				ParseXAttribute (element);
				return;
			}

			if (IsXmlDirective ()) {
				ParseXmlDirective (element);
				return;
			}

			if (IsIgnorable ()) {
				return;
			}

			XamlPropertySetter prop = element.LookupProperty (reader);
			if (prop == null)
				throw ParseException ("The property {0} was not found.", reader.LocalName);
			object value = ParseAttributeValue (element, prop);
			prop.SetValue (value);
		}
开发者ID:shana,项目名称:moon,代码行数:31,代码来源:XamlParser.cs

示例12: ParseTextBlockText

		private void ParseTextBlockText (XamlObjectElement block)
		{
		}
开发者ID:shana,项目名称:moon,代码行数:3,代码来源:XamlParser.cs

示例13: ParseTemplateElement

		private void ParseTemplateElement ()
		{
			Type t = ResolveType ();
			if (t == null)
				throw ParseException ("Unable to find the type {0}", t);
			object o = InstantiateType (t);

			XamlObjectElement element = new XamlObjectElement (this, reader.LocalName, o);
			OnElementBegin (element);
			
			ParseElementAttributes (element);

			string template_xml = reader.ReadInnerXml ();
			
			FrameworkTemplate template = o as FrameworkTemplate;

			unsafe {
				template.SetXamlBuffer (ParseTemplate, CreateXamlContext (template), template_xml);
			}

			//
			// ReadInnerXml will read our closing </ControlTemplate> tag also, so we manually close things
			//
			OnElementEnd ();
		}
开发者ID:shana,项目名称:moon,代码行数:25,代码来源:XamlParser.cs

示例14: ParseObjectElement

		private void ParseObjectElement ()
		{
			Type t = ResolveType ();
			if (t == null)
				throw ParseException ("Unable to find the type {0}.", reader.LocalName);

			object o = InstantiateType (t);

			XamlObjectElement element = new XamlObjectElement (this, reader.LocalName, o);

			SetElementTemplateScopes (element);
			OnElementBegin (element);
			
			ParseElementAttributes (element);

			// This is a self closing element ie <Rectangle />
			if (reader.IsEmptyElement)
				OnElementEnd ();
		}
开发者ID:shana,项目名称:moon,代码行数:19,代码来源:XamlParser.cs

示例15: ParseAttributeMarkup

		private object ParseAttributeMarkup (XamlObjectElement element, XamlPropertySetter property)
		{
			MarkupExpressionParser parser = new SL4MarkupExpressionParser (element.Object, property.Name, this, element);

			string expression = reader.Value;
			object o = parser.ParseExpression (ref expression);
			return o;
		}
开发者ID:shana,项目名称:moon,代码行数:8,代码来源:XamlParser.cs


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