Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions XAML conversion/Parsers/ObjectParser.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Xml.Linq;
using System.Windows.Markup;

namespace XamlConversion.Parsers
{
class ObjectParser : XamlParser
{
public ObjectParser(XamlConvertor.State state)
: base(state)
{}
{ }

public string VariableName { get; protected set; }

Expand All @@ -24,9 +25,16 @@ protected override void ParseAttribute(XAttribute attribute)
{
if (attribute.IsNamespaceDeclaration)
return;
try
{
var propertyName = attribute.Name.LocalName;
SetProperty(VariableName, Type, propertyName, attribute.Value);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(attribute.Name);
}

var propertyName = attribute.Name.LocalName;
SetProperty(VariableName, Type, propertyName, attribute.Value);
}

protected override void ParseElement(XElement element)
Expand All @@ -39,11 +47,23 @@ protected override void ParseElement(XElement element)
}
else
{
throw new NotImplementedException();
var propertyParser = new PropertyParser(State, this);
object[] attributes = Type.GetCustomAttributes(typeof(ContentPropertyAttribute), true);

if (attributes.Length > 0)
{
XElement e = new XElement(VariableName + "." +
(attributes[0] as ContentPropertyAttribute).Name, element);
propertyParser.Parse(e);
}
else
{
throw new NotImplementedException();
}
}
}

protected override void ParseEnd()
{}
{ }
}
}
}