为什么我的 FlowDocument 不使用整个宽度?
我正在将 HTML 转换为 XAML 并使用 FlowDocumentScrollViewer 将其加载到 StackPanel 中。内容从 HTML 中正确呈现。我的问题是内容或 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 是一个普通的堆栈面板。问题是 flowdocumentscrollviewer 使用整个宽度,但看起来 flow document 仅使用大约 40 %
我忽略了什么?提前致谢!
I am converting HTML to XAML and loading it in a StackPanel with FlowDocumentScrollViewer. The content is rendering correctly from the HTML. My issue is the content or the FlowDocument does not appear to use the whole width.
The html to xaml conversion looks like this
<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 is a normal stackpanel. The issue is the flowdocumentscrollviewer uses the whole width but it looks like the flow document only uses about 40 %
What am I overlooking? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这个问题。我的 xaml 中有一个带有堆栈面板的文档滚动查看器,因此它无法正确重新生成。我删除了这个并解决了问题。
I found the issue. I had a documentscrollviewer with a stackpanel in my xaml so it was not renering correctly. I removed this and that fixed the issue.