阅读 Windows 手机的动态 xml 阅读器? [英] read dynamic xml reader for windows phone?
问题描述
在我的 XML 文件中,章节标签有更多章节标签.我需要在第一页显示章节名称.当我单击列表框中的章节时,下一页将显示该章节中的标题.然后单击标题下一页将显示内容.我尝试了静态页面.它会清晰地运行.但是我在动态页面导航中遇到了问题.`
In my XML file chapters tag has more chapter tag.i need to display chapters name in first page.when i click chapter in the list box next page will display the titles in the chapter.then click the title next page will display the content.i tried static page.it will run clearly.but i had problem in dynamic page navigation.`
<chapter>
<title>
<![CDATA[Decorating Tips]]>
</title>
<position>1</position>
<paragraphs>
<paragraph>
<title>To Determine Gender or Not</title>
<position>1</position>
<text>
<![CDATA[<meta name="viewport" content="width=320" /><p style="text-align: justify;">With the creation of ultrasounds,<br/>many decision, you can move forward.</p>]]>
</text>
</paragraph>
<paragraph>
<title>Neutral, Please</title>
<position>2</position>
<text>
<![CDATA[<meta name='viewport' content='width=device-width,height=device-height' /><p style="text-align: just></p>]]>
</text>
</paragraph>
<paragraph>
<title>Noah’s Ark</title>
</chapter>
<chapter>
<title>
<![CDATA[The Necessities]]>
</title>
<position>2</position>
<paragraphs>
<paragraph>
<title>Paint</title>
<position>1</position>
<text>
<![CDATA[<p style="text-align: justify;">Sne are shades of yellow, green, beige of.</p>]]>
</text>
</paragraph>
<paragraph>
<title>Wall Paper and Bedding</title>
<position>2</position>
<text>
<![CDATA[<p style="text-align: justifinundated with themes. And since the or baby.</p>]]>
</text>
</paragraph>
</paragraphs>
</chapter>
<chapter>
<title>
<![CDATA[Other Fun Ways to Decorate]]>
</title>
<position>3</position>
<paragraphs>
<paragraph>
<title>Twinkle Lights Around the Perimeter</title>
<position>1</position>
<text>
<![CDATA[<p style="text-align: justify;">during the day.<br /></p>]]>
</text>
</paragraph>
<paragraph>
<title>Growth Chart</title>
<position>2</position>
<text>
<![CDATA[<p style="text-align: justify;">Ysomeday – and the date.</p>]]>
</text>
</paragraph>
</paragraphs>
</chapter>
</chaptesr>`
推荐答案
假设您已经创建了描述章节-段落-段落结构的类层次结构.
Suppose you already create class hierarchy that describe chapters-paragraphs-paragraph structure.
在第一页将DataContext
绑定到Chapters collection
以显示每个章节.
On first page bind DataContext
to Chapters collection
to display each chapter.
当用户点击某个章节时,将ViewModel
上的SelectedChapter
属性设置为点击的Chapter
对象.然后导航到第二页,其中 DataContext
绑定到 SelectedChapter
属性以显示每个段落.
When user clicks on some chapter, set SelectedChapter
property on ViewModel
to clicked Chapter
object. Then navigate to second page, where DataContext
is binded to SelectedChapter
property to display each paragraph.
当用户点击某个段落时,将 ViewModel
上的 SelectedParagraph
属性设置为点击的 Paragraph
对象,依此类推...
When user clicks on some paragraph, set SelectedParagraph
property on ViewModel
to clicked Paragraph
object, and so on...
这篇关于阅读 Windows 手机的动态 xml 阅读器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!