2012-02-24 34 views
0

在我的XML文件的章节标记有更多的章节tag.i需要显示章节第一page.when的名字我的列表框中单击下一章页面将显示在标题chapter.then点击标题下一个页面将显示content.i试图静态page.it将运行clearly.but我在动态网页有问题navigation.`阅读windows phone的动态xml阅读器?

<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>` 
+0

1条建议,更好地读取相同的XML文件中的两页(即章页,扉页)? – 2012-02-27 10:48:58

+1

当我点击相应的职称要display.then后在另一page.please点击标题描述显示帮助我的章节列表。 – Malarkodi 2012-02-27 11:29:29

+1

其简单的我认为,使用的XMLReader阅读首先是所有的章节和显示在网页上。然后,在用户单击章节后,使用导航技术将章节值传递到下一页。在那里读取相同的XML文件,但只查找你想要的章节,例如reader.Name.equals(章节名称)它不是一个解决方案。它的一个不同的逻辑就是这样!通过章值'NavigationService.Navigate(新URI( “/ SecondPage.xaml MSG =?” + string_chapter,UriKind.Relative));' – 2012-02-29 11:34:26

回答

1

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

在第一页绑定DataContextChapters collection以显示每个章节。

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

当用户点击某些段落,设置ViewModelSelectedParagraph属性点击Paragraph对象,等等...

+0

我试图自己。请给出一些示例代码。 – Malarkodi 2012-02-29 09:00:58