WPF中的文本系統主要用於在UI中使用文本,而不是用腳註和頭文件等生成複雜文檔。但是,框架已經編寫完成,因此如果您想添加自定義功能,您可以。
第一個問題:腳註和與文本一致的東西。 WPF提供了兩個類,用UIElement
表示文字:InlineUIContainer
和BlockUIContainer
。我會考慮編寫自己的自定義控件,它是專門設計用來具有腳註或類似行爲的行爲,並將其放在這兩個類中的一箇中。我發現這個MSDN方便,花花公子關係圖,如果你需要「雜誌上什麼是接受(鏈接在頁面的底部)
alt text http://i.msdn.microsoft.com/dynimg/IC66504.png
更多信息我不能完全明白你的意思風格故事流程「。 'FlowDocument'會自動將Block
派生的類(上圖中的藍色部分)排列到可用空間中,並且可以使用Floater
和Figure
內聯元素在對象周圍創建文本'流'。您還可以使用Figure
和Floater
作爲頁眉和頁腳功能。
下面是一些示例代碼:
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph>
5 green bottles standing on the wall,
5 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
there would be 4 green bottles standing on the wall;
</Paragraph>
<Paragraph>
4 green bottles standing on the wall,
4 green bottles standing on the wall,
<Floater HorizontalAlignment="Left" Width="250">
<BlockUIContainer>
<Button>This button is in a Floater</Button>
</BlockUIContainer>
</Floater>
and if one green bottle was to accidentally fall,
there would be 3 green bottles standing on the wall;
</Paragraph>
<Paragraph>
3 green bottles standing on the wall,
3 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
there would be 2 green bottles standing on the wall;
</Paragraph>
<Paragraph>
2 green bottles standing on the wall,
2 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
<InlineUIContainer>
<Button>This Button is inline</Button>
</InlineUIContainer>
there would be 1 green bottle standing on the wall...
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
你可以用自己的自定義控件更換Button
S(例如。與你的註腳勝內嵌按鈕)
這段代碼是: alt text http://www.freeimagehosting.net/uploads/5d5a85e395.jpg
我希望幫助!我並不確切知道你在做什麼,但我認爲你仍然可以使用FlowDocument
,只是使用WPF提供的大量文本操作設備,如果你確實需要額外的功能/佈局選項,可以創建一個新的類繼承Block
或Inline
或其他什麼,並寫在那裏的額外的東西,以利用所有的工作.net可以爲你做。 如果您需要了解更多信息,你可以閱讀更多關於在WPF文字上的東西MSDN:
Extra long article about how to use FlowDocument
The text content model used in WPF (where I got the image from)
享受自己:)
謝謝。問題是Floater不允許控制放置,而圖堅持把所有東西放在一個頁面上。我需要兩者的結合。 – yclevine 2010-07-23 08:34:59
雜誌風格的流程是指在後面的頁面上繼續其他內容的故事。 – yclevine 2010-07-23 08:42:20
嗯然後我不知道,你可以創建自己的自定義浮動圖形的東西,從Inline派生,並自己編寫專門的代碼...這將意味着你將獲得自定義功能,而不必重寫整個文本顯示系統 – 2010-07-23 11:42:07