internal XamlDomObject Process() { _rootNode.Namespaces.Add(new XamlDomNamespace(new NamespaceDeclaration(XamlLanguage.Xaml2006Namespace, "x"))); //TODO: We need to create "unknown" nodes for Content properties since Silverlight 3 doesn't support // direct content. I think that if we spew out unknown members with the right values, it'll right // things as attributes instead of content. foreach (var contentMember in from objectNode in _rootNode.DescendantsAndSelf() where objectNode.Type.ContentProperty != null where objectNode.HasMember(objectNode.Type.ContentProperty) select objectNode.GetMemberNode(objectNode.Type.ContentProperty)) { // Only special case things that have one child that is a value node if (contentMember.Items.Count == 1) { var valueNode = contentMember.Item as XamlDomValue; if (valueNode != null) { var fakeMember = new NonContentPropertyXamlMember(contentMember.Member); var newMemberNode = new XamlDomMember(fakeMember, valueNode); var parentObject = contentMember.Parent; parentObject.RemoveMemberNode(contentMember); parentObject.MemberNodes.Add(newMemberNode); } } } return(_rootNode); }
/// <summary> /// Gets types list which declared into XAML markup. /// </summary> /// <returns>Returns <see cref="Lardite.RefAssistant.ObjectModel.Checkers.XamlTypeDeclaration"/> collection.</returns> public IEnumerable <XamlTypeDeclaration> GetDeclaredTypes() { XamlDomObject rootNode = XamlDomServices.Load(_xamlReader) as XamlDomObject; return((rootNode != null) ? rootNode.DescendantsAndSelf().Select(t => new XamlTypeDeclaration(t.Type)) : new List <XamlTypeDeclaration>()); }