2012-02-24 39 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