本文整理汇总了C#中Mono.Xaml.XamlObjectElement类的典型用法代码示例。如果您正苦于以下问题:C# XamlObjectElement类的具体用法?C# XamlObjectElement怎么用?C# XamlObjectElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XamlObjectElement类属于Mono.Xaml命名空间,在下文中一共展示了XamlObjectElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SetElementTemplateScopes
private void SetElementTemplateScopes (XamlObjectElement element)
{
// This whole thing is basically copied from xaml.cpp AddCreatedItem
DependencyObject el_dob = element.Object as DependencyObject;
if (el_dob == null)
return;
// When instantiating a template, some elements are created which are not explicitly
// mentioned in the xaml. Therefore we need to keep walking up the tree until we find
// the last element which we set a value for Control::IsTemplateItem and propagate
// it from there.
XamlElement instance = CurrentElement;
while (instance != null) {
XamlObjectElement oe = element as XamlObjectElement;
if (oe == null) {
instance = instance.Parent;
continue;
}
DependencyObject dob = oe.Object as DependencyObject;
if (dob == null) {
instance = instance.Parent;
continue;
}
if (dob.ReadLocalValue (Control.IsTemplateItemProperty) == null) {
instance = instance.Parent;
continue;
}
el_dob.SetValue (Control.IsTemplateItemProperty, dob.GetValue (Control.IsTemplateItemProperty));
el_dob.TemplateOwner = dob.TemplateOwner;
break;
}
if (instance == null) {
el_dob.SetValue (Control.IsTemplateItemProperty, Context.IsExpandingTemplate);
el_dob.TemplateOwner = Context.TemplateBindingSource;
}
if (el_dob.GetValue (Control.IsTemplateItemProperty) != null) {
UserControl uc = el_dob as UserControl;
if (uc != null) {
// I can't come up with a test to verify this fix. However, it does
// fix a crasher in olympics when trying to play a new video from
// the recommendations list after the curreont video finishes
NameScope ns = NameScope.GetNameScope (uc);
NameScope.SetNameScope (uc.Content, ns);
NameScope.SetNameScope (uc.Resources, ns);
}
NameScope.SetNameScope (el_dob, NameScope);
}
}
开发者ID:shana,项目名称:moon,代码行数:59,代码来源:XamlParser.cs
示例17: XamlReflectionPropertySetter
public XamlReflectionPropertySetter (XamlObjectElement element, object target, PropertyInfo prop) : base (element, prop.Name, Helper.GetConverterFor (prop, prop.PropertyType))
{
this.target = target;
this.prop = prop;
}
开发者ID:shana,项目名称:moon,代码行数:5,代码来源:XamlPropertySetter.cs
示例18: AddToDictionary
private void AddToDictionary (XamlObjectElement obj, object value)
{
IDictionary rd = accessors.Getter (target) as IDictionary;
if (rd == null)
throw Parser.ParseException ("Collection property in non collection type.");
string key = obj.GetDictionaryKey ();
if (key == null)
throw Parser.ParseException ("You must specify an x:Key or x:Name for elements in a ResourceDictionary");
rd.Add (key, value);
}
开发者ID:fmaulanaa,项目名称:moon,代码行数:12,代码来源:XamlPropertySetter.cs
示例19: SetValue
public override void SetValue (XamlObjectElement obj, object value)
{
// We do this first to cover the case where you are setting a list to a list or
// a resource dictionary to a resource dictionary, binding to a binding, ect
// as opposed to adding items to the list or dictionary.
if (Type.IsAssignableFrom (value.GetType ())) {
prop.SetValue (target, ConvertValue (Type, value), null);
return;
}
{
Binding binding = value as Binding;
if (binding != null) {
SetBinding (binding);
return;
}
}
{
TemplateBindingExpression tb = value as TemplateBindingExpression;
if (tb != null) {
SetTemplateBinding (tb);
return;
}
}
if (typeof (IList).IsAssignableFrom (Type)) {
AddToCollection (obj, value);
return;
}
if (typeof (IDictionary).IsAssignableFrom (Type)) {
AddToDictionary (obj, value);
return;
}
throw Parser.ParseException ("Unable to set property {0} to value {1}.", Name, value);
}
开发者ID:shana,项目名称:moon,代码行数:38,代码来源:XamlPropertySetter.cs
示例20: AddToDictionary
private void AddToDictionary (XamlObjectElement obj, object value)
{
IDictionary rd = prop.GetValue (target, null) as IDictionary;
if (rd == null)
throw Parser.ParseException ("Collection property in non collection type.");
rd.Add (obj.X_Key, value);
}
开发者ID:shana,项目名称:moon,代码行数:8,代码来源:XamlPropertySetter.cs
注:本文中的Mono.Xaml.XamlObjectElement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论