2011-11-14 16 views
2

我將HTML轉換爲XAML並使用FlowDocumentScrollViewer將其加載到StackPanel中。內容從HTML正確呈現。我的問題是內容或FlowDocument似乎不使用整個寬度。爲什麼我的FlowDocument不使用整個寬度?

HTML以XAML轉換看起來像這樣

<FlowDocument xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> 
<Paragraph>Central Contractor Registration Is Free It Shouldn't Cost You A Dime </Paragraph> 
<Paragraph>Central Contractor Registration is free. The federal government does not charge a fee to register your business in the central contractor registration database. I am telling you that central contractor registration is free because there is some confusion out there and I want to [...] </Paragraph> 
</FlowDocument> 

Dim conversionhtml As String = "<FlowDocument xml:space=""preserve"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""><Paragraph>Central Contractor Registration Is Free It Shouldn't Cost You A Dime </Paragraph><Paragraph>Central Contractor Registration is free. The federal government does not charge a fee to register your business in the central contractor registration database. I am telling you that central contractor registration is free because there is some confusion out there and I want to [...]</Paragraph></FlowDocument>" 
Dim fd As FlowDocument = DirectCast(Markup.XamlReader.Parse(conversionhtml), FlowDocument) 
Dim fdr As New FlowDocumentScrollViewer() 
fdr.Document = fd 
FeedsDisplay.Children.Add(fdr) 

feedsdisplay是正常的StackPanel。問題是flowdocumentscrollviewer使用整個寬度,但它看起來像流程文檔只使用大約40%

我忽略了什麼?提前致謝!

+0

是否將'Horizo​​ntalAlignment ='Stretch''添加到FlowDocument標記幫助中? – Reddog

+0

flowdocument本身不允許horizo​​ntalAlignment,但我確實嘗試了PageWidth = Horizo​​ntalAlignment.Stretch,並得到了相同的結果 – Jim

回答

0

我發現了這個問題。我有一個在我的xaml中有一個stackpanel的文件查看器,所以它沒有正確的renering。我刪除了這個,並解決了這個問題。

相關問題