阅读Windows Phone的动态xml阅读器?

时间:2012-02-24 13:05:00

标签: xml windows-phone-7

在我的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&#8217;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,&nbsp; 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&nbsp; 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 &ndash; and the date.</p>]]>
      </text>
    </paragraph>
          </paragraphs>
</chapter>
</chaptesr>`

1 个答案:

答案 0 :(得分:1)

假设您已经创建了描述章节段落结构的类层次结构。

在第一页上将DataContext绑定到Chapters collection以显示每个章节。

当用户点击某个章节时,请在SelectedChapter上设置ViewModel属性以点击Chapter对象。然后导航到第二页,其中DataContext绑定到SelectedChapter属性以显示每个段落。

当用户点击某个段落时,请在SelectedParagraph上设置ViewModel属性以点击Paragraph对象,依此类推......

相关问题