在我的XML文件中,章节标签有更多章节标签。我需要在第一页显示章节名称。当我点击列表框中的章节下一页将显示章节中的标题。然后点击标题下一页将显示content.i尝试静态page.it将运行清楚。但我在动态页面导航中遇到问题。
<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>`
答案 0 :(得分:1)
假设您已经创建了描述章节段落结构的类层次结构。
在第一页上将DataContext
绑定到Chapters collection
以显示每个章节。
当用户点击某个章节时,请在SelectedChapter
上设置ViewModel
属性以点击Chapter
对象。然后导航到第二页,其中DataContext
绑定到SelectedChapter
属性以显示每个段落。
当用户点击某个段落时,请在SelectedParagraph
上设置ViewModel
属性以点击Paragraph
对象,依此类推......