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%
我忽略了什麼?提前致謝!
是否將'HorizontalAlignment ='Stretch''添加到FlowDocument標記幫助中? – Reddog
flowdocument本身不允許horizontalAlignment,但我確實嘗試了PageWidth = HorizontalAlignment.Stretch,並得到了相同的結果 – Jim